Possible to achieve a "cut" image look using only CSS3? - image

Referring to the kind of look of the images seen on this site - http://sl.dream-theme.com/html/albums-light.html (I'm in no way involved with this WP theme, just providing an example). The author is using jRaphael to create "path cuts" which is a nice and browser-safe approach, but I'd like to avoid including an additional library solely for that purpose.

very basic:
http://dabblet.com/gist/2874826
uses css pseudo elements to mask the image (pretty descent browser support -- will render as a square image in legacy browsers, probably nbd?)
If shadows / borders / things are needed you could add and additional wrapper to fake the slanted borders using more pseudo elements or a manipulated (transformed) box, or something.

Related

Has anyone been able to nicely integrate the ACE editor into reveal.js?

This is the closest I've seen to that, and even it doesn't do a particularly good job; it certainly doesn't integrate (if it can even be said to do so) as well as the the highlight.js blocks reveal.js supports by default (which aren't responsive and lack a bunch of the other nice features of ACE).
I tried naively embedding an ACE textbox in a slide myself, and it didn't work out well. Reveal changed the size of the thing, but even after fixing that (and setting "text-align:left") the visual cursor didn't align with the actual cursor, and the editor warning icon was tiny.
The problem with ACE and reveal.js is the are the css attributes zoom or transform: scale() which reveal uses to fit the content to the screen. ACE requires pixel fonts and does not use the scaling in calculating mouse cursor positions.
I made a small fork and added a reval.js specific check for the editor.
see https://github.com/waywaaard/ace
https://github.com/waywaaard/ace/commit/e4e3da28515ef7a58fe85378dd4dd557918fc4a6
This fixes the problem for my use cases.
My way of solving those issues is embedding ACE in an iframe instead of using it directly. I wrote a reveal.js plugin that makes embedding an ACE editor easy:
https://github.com/Gottox/reveal.js-ace

Is There Aspect Ratio Cropping in CQ5, Not Just Free Crop?

The image component allows Free Ratio cropping out of the box. I'm a bit baffled at why there is no Aspect Ratio option (keeping height and width constrained to each other), which would work much better for us. Is this an existing feature that can be enabled, or a custom task in Java?
I am using CQ 5.4.
This is OOTB since 5.4 (atleast), though not well documented.. Set up your smart image widget like so:
<image-16x10
jcr:primaryType="cq:Widget"
allowFileReference="{Boolean}true"
cropParameter="./image-16x10/imageCrop"
fileReferenceParameter="fileReference"
name="./image-16x10/file"
requestSuffix=".img.png"
rotateParameter=""
title="16x10"
xtype="html5smartimage">
<cropConfig
jcr:primaryType="nt:unstructured">
<aspectRatios
jcr:primaryType="nt:unstructured">
<aspectRatio-16x10
jcr:primaryType="nt:unstructured"
text="16x10"
value="16,10"/>
</aspectRatios>
</cropConfig>
</image-16x10>
The cropConfig node structure is what youre interested in. text="16x:10" is what will appear in the Crop dropdown, value="16,10" is the actual fixed Crop size for the tool. You can add as many predefined crops you want per html5smartimage widget.
The image-16x10 and aspectRatio-16x10 names aren't required, but not a useful convention to help in maintainability of the config.If you allow multiple aspectRatios then the image-16x10 naming probably doesnt make as much sense tho its not a bad idea to provide semantic naming to your aspectRatio definition node.
If you'd like to generate images with different aspectRatios, try this...
http://experience-aem.blogspot.com/2013/09/cq-image-custom-aspect-ratios-crop.html
The crop parameters are saved in different properties and not "cropParameter" of the html5smartimage widget
That would be a custom JavaScript widget: the one you're using (smart image) does not have an aspect ratio functionality (or just I never seen one), even in 5.6.
You could extend the existing widget, and provide this functionality in your own, using Javascript though -- it's not trivial, but not rocket science either -- see source code for smart image to see how it extends smart panel, and then registers itself into the framework.

Set a country background to my Google Geomap

A few days ago I've explored geomaps and, however, it turned out to be easy to change the properties of the elements.
But I have two questions:
I'd like to add rivers and forests on the maps. So Ive considered to set a background image instead of the geomaps figure. But I can't find a way to get this one fixed. Is there a way to set a background picture for a country or region?
How can I change the shape of the "bubbles" when you select a city e.g. "London"? I'd like to change it to a square.
Thanks in advance for your help!
Unfortunately what you're looking for is not available in geocharts in their current implementation.
Using a background image is possible in the sense that you can use CSS to make all shapes in the map transparent, and use a background image in the div to make it appear as if the little circles are being drawn on a map with forest and rivers, but you will run in to two big hurdles:
Your map will need to be identical in size/layout to the Google Maps SVG
If Google ever changes the SVG they use (or the view/projection they use) you will need to edit yours too
This isn't ideal, obviously. You could work around it by creating custom javascript to write rivers and forests on your map, but that is going to be a huge headache (especially if you are using multiple maps/views).
As for the circles, you can't change them to squares without hacking the actual SVG in the background with javascript. While this is definitely possible (if you're really good with SVG/Javascript), it again isn't using any of the fancy features of geocharts, and is more just a custom solution that will have to be updated if/when google updates their API.
Rather than doing it that way, you may want to look in to the same implementation on google maps itself. That will allow you to use custom markers, draw custom shapes, etc. with a lot more flexibility (and a much more stable API).

Sophisticated HTML5 Image Map?

I have an image of a living room, which I'm turning into a menu for a new site I'm working on. The idea is that you can click on certain items in the room, like a chair, desk, couch, etc and get taken to the desired page. I'm wondering if there is a clever way of doing this. Since the items are not simple shapes, I don't want to use a standard image map.
Thanks for you help!
I'm answering because a Google search brought me here...
Because you asked for a tool:
GIMP Has a really good Image map creation function.
Open your image in GIMP and select Filters > Web > ImageMap
From there you can create image maps by drawing on the image. Saving will generate HTML you can then tailor to your needs.
This tool looks to be a solid image mapper: http://www.image-maps.com/
I'd suggest doing this with a canvas and SVG's, it would make this quite a bit easier, and more professional.
As Korvin mentioned, doing this in SVG is probably the easiest option, because you can attach events to objects in SVG rather than having to manually specify a particular area in which to listen for events.
If you go this route, I recommend using the RaphaelJS library which has a nice syntax and the advantage of working in IE pre version 9. Here's a demo which, although it uses onmouseover instead of onclick, it might be close to what you're trying to achieve:
http://raphaeljs.com/australia.html

Document creation and editing online

What language or technology would I need to be able to create documents online? I want to be able to add text and images and move them into position, resize etc, similar to this.
And then when complete, create a PDF from them.
Sorry if this is a bit vague, I just need to know where to start researching.
You need to decide on your basic technology: Flash, Silverlight, Canvas, client-side SVG, server-side SVG or server-side bitmap. There are also commercial solutions that work with Adobe InDesign documents (and probably a host of other proprietary formats) but I'd expect those not to be cheap.
Flash/Silverlight require plugins, and are considered by some to be a dying technology - though I am sure that is disputed. Canvas is 'very HTML5' and is essentially a bitmap built/rendered on the client, but if you are ultimated rendering to PDF it may not provide the resolution you need. The same limitation affects building an image server-side too - you should probably be dealing with vector elements plus bitmaps, rather than rendering everything to pixels as you go.
That leaves SVG in my list, either on the client (see RaphaelJS) or on the server (see Inkscape). I'm doing some work with server-side SVG rendering at the moment, and it is promising; although subject to more scalability issues than client-side, it doesn't suffer from browser-compatibility issues or the limitations of browser rendering.
The biggest issue in browser SVG rendering is flowed paragraph text and text in/on a path - I am not sure how well these are implemented in modern browsers, or how much agreement there is between them. This is especially the case given that some of these require SVG1.2, and browsers (afaik) are only just settling on SVG1.1, after many years. But, if you just want to do standard blocks of text, bitmaps and vector elements, browser-based SVG should suit you fine.
The example you've given uses a server-side technology (SVG, or perhaps a commercial format) and renders to low-res PNG on the client.
In your case, once you've considered how to 'do the editing', you'll need to consider how to render to PDF, which will be done on the server. You could go low-level and use something like FPDF, use a report renderer like Jasper, or use a graphics system like GhostScript, Inkscape, Scribus, ps2pdf, svg2pdf etc.
Aside: I normally don't answer questions without obvious prior research. But, since you've indicated that you will indeed undertake this, I'm happy to help get you started.

Resources