On 09/21/2010 09:16 PM, Sergiu Dumitriu wrote:
On 09/21/2010 07:58 PM, Marius Dumitru Florea wrote:
Hi Sergiu,
On 09/21/2010 08:27 PM, Sergiu Dumitriu wrote:
On 09/08/2010 10:40 PM, Marius Dumitru Florea wrote:
Hi devs,
Currently the image plugin [1] allows us to create image thumbnails by specifying the image width and/or height in the query string of the image attachment download URL:
/xwiki/bin/download/Spage/Page/image.jpg?width=100
I propose that we:
(A) Use the image width and/or height (when they are specified in the image syntax using pixel unit) to resize the image on the server side. For instance:
[[image:logo.jpg||width="100px"]]
will be linked to
/xwiki/bin/download/Spage/Page/logo.jpg?width=100
and
[[image:logo.jpg||style="height: 50px; width: 70px"]]
will be linked to
/xwiki/bin/download/Spage/Page/logo.jpg?width=70&height=50
+1.
The image plugin also accepts a quality parameter that controls the compression quality when encoding jpeg images. The default value of this parameter (i.e. when not specified in the URL) is configurable. I propose we use 0.3 by default, 1 representing the best quality.
0.3 seems very low to me. The resulting image has serious artifacts, which can be ignored for low-level photographs, but which is unacceptable if the images are technical. I think that we should try to give less artifacts.
One option would be to use the same quality as the original image, but I don't know if the JDK has APIs for reading this information from the picture, although it can be obtained by parsing the raw image. The simpler thing would be to use something in the middle, 0.5?
The default compression quality is configurable. The question is what do we favor by default: performance or quality?
Middle?
I'm fine with 0.5. Let's see what others think. Thanks, Marius
(B) Add the ability to limit the image dimensions (preserving aspect ratio) when the image width and/or height are not specified in the image syntax (or when they are not using pixel unit). The width and height limit will be configurable and -1 by default (i.e. no limitation). For instance:
image:logo.jpg
will be linked to
/xwiki/bin/download/Spage/Page/logo.jpg?width=1024
when width limit is 1024, and to
/xwiki/bin/download/Spage/Page/logo.jpg?width=1024&height=768&keepAspectRatio=true
when width limit is 1024 and height limit is 768. Note that in this case the image aspect ratio is preserved. The image is resized to best fit the limits. If the user want to bypass the limit he has to specify the image width/height in the image syntax.
I'm not sure of this. How do you get the original image back?
Either you set the width/height limit to -1 or to a reasonable large number in the configuration or you specify the original image width/height in the image wiki syntax. Alternatively you can create a link to the original image with:
[[image:logo.jpg>>attach:logo.jpg]]
OK, this is good. +1 here too.
Note that image width/height limit are -1 by default in the standard XE distribution. Their purpose it to limit image width/height in wikis where users upload large images that can't be display in their full size on a web page (e.g. 3648 x 2736 px). In this case a link to the original image is enough.
Thanks for the feedback, Marius
I'm +1 for both (A) and (B). WDYT?
Thanks, Marius
[1] http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-core/src/main/j...