Hi,

Currently we simply copy-paste the attributes into the generated HTML,
which makes the syntax ambiguous. E.g. it is possible to write something
like

[[image:logo.jpg||width="100px" height="50%" style="width: 45%; height:
100px"]]

Using the size information for resizing pictures sound interesting, but
regarding the example above:

What will happen if the user specifies width or height in percent?
What if pixel and percent numbers are mixed (e.g. width is in px and
height in %)?
What takes precedence, width attribute or CSS style attribute?
Will the size information XWiki uses to resize images be the same as
various browsers use to display the image?


In general, I think copy-pasting the attributes is bad (esp. from
security PoV). I'd prefer having a fixed set of supported attributes
(subset of HTML/CSS) that are handled in a fully deterministic way. This
would for example allow to specify how exactly the width information is
parsed and transform the example above into a non-ambiguous form on save.

Since your change would introduce parsing for the parameters, it might
be a good point to start going into this direction, WDYT?


Thanks,
Alex

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
> 
> 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.
> 
> (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 +1 for both (A) and (B). WDYT?
> 
> Thanks,
> Marius
> 
> [1] 
> http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/plugin/image/
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
> 
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to