Hi devs,
I've already proposed a thumbnail module in the past
(
http://markmail.org/thread/3le7qxziog2p7bsd) but it felt short in terms
of design. I reckon it's more of a URL cache module for
images/thumbnails and probably doesn't make much sense in the platform.
I would like still to propose one change separately, that was going
together with this module : adding a cropping API to the current image
plugin. This would allow to not only pass dimensions information when
downloading an image, but also to pass coordinates to crop a subimage
out of the original image.
Practically, it's adding a "boundaries" URL parameter (in addition to
the existing width, height, quality and keepAspectRatio existing
parameters), that is a comma separated list of x, y, width and height
used to construct the subimage.
Right now the code is in
https://github.com/jvelo/xwiki-platform-thumbnails/tree/master/src/main/jav…,
I will make a proper pull request to discuss the patch if their is interest.
Note I also have a generic UI component to perform resizing and store
image boundaries for an attachment in an XObject that I can share (and
even plug into the user profile for example).
On the longer term, their is a discussion to have around how to wire
attachment transformation from URLs. Maybe a "transformations" URL
parameter that takes a list of hints of transformation components ? Then
the resizing/cropping could be implemented as transformations in a new
image module ? WDYT ?
Finally, finishing note, I've also written a new image processor for the
current image plugin API, based on
https://code.google.com/p/java-image-scaling/ that yields images of much
better quality compared to the current implementation based on
awt/graphics2d. See for example the before/after :
http://imgur.com/oU9v5 (for the before, those had a quality param of
"1", i.e. maxed out). Code is there :
https://github.com/jvelo/xwiki-platform-thumbnails/blob/master/src/main/jav….
One thing I didn't do yet is to extract a superclass from it and the
base impl. If there is interest, we could provide this processor as an
alternative. Maybe with a parameter config to pass the hint of the
processor to use. WDYT ?
Thanks,
Jerome