[xwiki-users] [Vote] Resize images on the server side to reduce page loading time
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/j...
On 09/08/2010 11: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
If I remember correctly this would mean that we give special meaning to some parameters (right now they are automatically copied to HTML attributes of the element). I don't remember exactly why, but I think this was an issue (Thomas? Vincent?) otherwise I would be +1 for this, image will be resized anyway, and let's hope the image plugin can do it as well as the browser would (in terms of quality of the result).
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 would say we would need a way to bypass and say "original size", be it a special value of the width (negative) or another method. +0 for B
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... _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
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
This seems to be fuzzing the line between url parameters and html tag attributes. why not just use [[image:logo.jpg?width=100px]]
and
[[image:logo.jpg||style="height: 50px; width: 70px"]]
will be linked to
/xwiki/bin/download/Spage/Page/logo.jpg?width=70&height=50
Parsing CSS and extracting widths and heights for server side scaling?
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?
+1 B A I need to hear more about how it will be implemented, from what i read it doesn't look right. Caleb
Thanks, Marius
[1] http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-core/src/main/j... _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
On Wed, Sep 8, 2010 at 23:08, Anca Luca <[email protected]> wrote:
On 09/08/2010 11: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
If I remember correctly this would mean that we give special meaning to some parameters (right now they are automatically copied to HTML attributes of the element). I don't remember exactly why, but I think this was an issue (Thomas? Vincent?)
otherwise I would be +1 for this, image will be resized anyway, and let's hope the image plugin can do it as well as the browser would (in terms of quality of the result).
We already talked about that with Marius and URLs used by the rendering are generated by WikiModel component which has a special XWiki implementation so we planned to add a WikiModel#getImageURL with the custom parameters like you have WikiModel#getgetAttachmentURLURL. So no need to give any meaning to the parameters at rendering level.
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 would say we would need a way to bypass and say "original size", be it a special value of the width (negative) or another method.
+0 for B
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... _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Thomas Mortagne
On Thu, Sep 9, 2010 at 09:09, Thomas Mortagne <[email protected]>wrote:
On Wed, Sep 8, 2010 at 23:08, Anca Luca <[email protected]> wrote:
On 09/08/2010 11: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
If I remember correctly this would mean that we give special meaning to some parameters (right now they are automatically copied to HTML attributes of the element). I don't remember exactly why, but I think this was an issue (Thomas? Vincent?)
otherwise I would be +1 for this, image will be resized anyway, and let's hope the image plugin can do it as well as the browser would (in terms of quality of the result).
We already talked about that with Marius and URLs used by the rendering are generated by WikiModel component which has a special XWiki implementation so we planned to add a WikiModel#getImageURL with the custom parameters like you have WikiModel#getgetAttachmentURLURL. So no need to give any meaning to the parameters at rendering level.
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 would say we would need a way to bypass and say "original size", be it a special value of the width (negative) or another method.
Like Anca said and in Flickr style, it would be great to have a value for the original size, not just -1 (no limitation), but for a specific file. Otherwise sounds good to me. Thanks, Caty
On 09/09/2010 12:08 AM, Anca Luca wrote:
On 09/08/2010 11: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
If I remember correctly this would mean that we give special meaning to some parameters (right now they are automatically copied to HTML attributes of the element). I don't remember exactly why, but I think this was an issue (Thomas? Vincent?)
otherwise I would be +1 for this, image will be resized anyway, and let's hope the image plugin can do it as well as the browser would (in terms of quality of the result).
For jpeg images there is the quality parameter that is configurable so you can set it to a value closer to 1 to preserve image quality. Also, I'm refactoring the image plugin to use a component for image processing. The default implementation will use javax.imageio and java.awt for decoding, scaling and encoding images. If you are not satisfied with the result you should be able to write a custom implementation using third party image processing libraries.
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 would say we would need a way to bypass and say "original size", be it a special value of the width (negative) or another method.
If the image width/height limit is reasonable for a web page (you can't expect to display 3640x2736 images on the web) then you won't have to view the original image most of the time. And if you do want to view the original image then you can specify the (original) image width/height to bypass the limit (since this won't happen often it won't be an overhead for the user). Limiting the image width/height is very useful when users attach photos without resizing them first to a web-friendly width/height. Instead of downloading a few MB you'll be downloading just a few KB. Thanks for your feedback, Marius
+0 for B
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... _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
On 09/09/2010 09:30 AM, Ecaterina Valica wrote:
On Thu, Sep 9, 2010 at 09:09, Thomas Mortagne<[email protected]>wrote:
On Wed, Sep 8, 2010 at 23:08, Anca Luca<[email protected]> wrote:
On 09/08/2010 11: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
If I remember correctly this would mean that we give special meaning to some parameters (right now they are automatically copied to HTML attributes of the element). I don't remember exactly why, but I think this was an issue (Thomas? Vincent?)
otherwise I would be +1 for this, image will be resized anyway, and let's hope the image plugin can do it as well as the browser would (in terms of quality of the result).
We already talked about that with Marius and URLs used by the rendering are generated by WikiModel component which has a special XWiki implementation so we planned to add a WikiModel#getImageURL with the custom parameters like you have WikiModel#getgetAttachmentURLURL. So no need to give any meaning to the parameters at rendering level.
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 would say we would need a way to bypass and say "original size", be it a special value of the width (negative) or another method.
Like Anca said and in Flickr style, it would be great to have a value for the original size, not just -1 (no limitation), but for a specific file. Otherwise sounds good to me.
Do you think that specifying the original width/height (or a greater value since the image plugin never increases the image dimensions) in the image syntax for a specific very large image is an important overhead? (see also my reply to Anca). If so, I can think of ways to enforce the original width/height. Do you agree with the rest of the proposal? Thanks for your feedback, Marius
Thanks, Caty _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
Hi Caleb, On 09/09/2010 02:22 AM, Caleb James DeLisle wrote:
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
This seems to be fuzzing the line between url parameters and html tag attributes. why not just use [[image:logo.jpg?width=100px]]
First of all, you make the assumption that users know what a URL query string is. I don't fully agree with this. Then some users might get confused if there are two ways of specifying image width/height: should we put the width/height in the image reference or in the image parameters? Finally, writing: [[image:logo.jpg?width=100||width=50px]] makes no sense. Why would you want to download a 100px image when you display it at 50px only. Also, IMO wiki syntax is independent from HTML. When you write: [[image:logo.jpg||width="100px"]] "width" is a parameter of the image. This wiki syntax could be rendered in many formats. One of these formats is HTML, but it's not the only one. When rendered in HTML the width parameter is mapped to the width HTML image attribute but that doesn't mean we can't use the width parameter for other things, like adjusting the image URL. IMO what's really important is to honor user expectations. When a user writes: [[image:logo.jpg||width="100px"]] he expects to see the logo.jpg image displayed and its width to be 100px. My proposal doesn't change this. Resizing the image on the server is an optimization and I think most of the users will be happy with it (the page will load faster).
and
[[image:logo.jpg||style="height: 50px; width: 70px"]]
will be linked to
/xwiki/bin/download/Spage/Page/logo.jpg?width=70&height=50
Parsing CSS and extracting widths and heights for server side scaling?
Yes, using http://cssparser.sourceforge.net/ .
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?
+1 B
A I need to hear more about how it will be implemented, from what i read it doesn't look right.
As Thomas said, it will be implemented in a XWiki specific implementation of WikiModel ( http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-rendering/xwiki... ). We're going to add a method to get the image URL based on: document reference, attachment file name and image parameters. The implementation looks for the width, height and style parameters and tries to extract image width/height from them. If it succeeds then it adds this information to the query string of the attachment download URL. When the image is requested by the browser the image plugin is called and it uses the width and height request parameters (if specified) to scale the image attachment. The image size is never increased. The image plugin uses a component for image processing (decode, scale, encode). The default implementation of this component uses javax.imageio and java.awt classes for image processing. Thanks for your feedback, Marius
Caleb
Thanks, Marius
[1] http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-core/src/main/j... _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
Marius Dumitru Florea wrote:
Hi Caleb,
On 09/09/2010 02:22 AM, Caleb James DeLisle wrote:
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
This seems to be fuzzing the line between url parameters and html tag attributes. why not just use [[image:logo.jpg?width=100px]]
First of all, you make the assumption that users know what a URL query string is. I don't fully agree with this. Then some users might get confused if there are two ways of specifying image width/height: should we put the width/height in the image reference or in the image parameters? Finally, writing:
[[image:logo.jpg?width=100||width=50px]]
makes no sense. Why would you want to download a 100px image when you display it at 50px only.
Also, IMO wiki syntax is independent from HTML. When you write:
[[image:logo.jpg||width="100px"]]
"width" is a parameter of the image. This wiki syntax could be rendered in many formats. One of these formats is HTML, but it's not the only one. When rendered in HTML the width parameter is mapped to the width HTML image attribute but that doesn't mean we can't use the width parameter for other things, like adjusting the image URL.
IMO what's really important is to honor user expectations. When a user writes:
[[image:logo.jpg||width="100px"]]
he expects to see the logo.jpg image displayed and its width to be 100px. My proposal doesn't change this. Resizing the image on the server is an optimization and I think most of the users will be happy with it (the page will load faster).
I can see the logic in this. +1
and
[[image:logo.jpg||style="height: 50px; width: 70px"]]
will be linked to
/xwiki/bin/download/Spage/Page/logo.jpg?width=70&height=50
Parsing CSS and extracting widths and heights for server side scaling?
Yes, using http://cssparser.sourceforge.net/ .
'IMO wiki syntax is independent from HTML. When you write [...] "width" is a parameter of the image. This wiki syntax could be rendered in many formats.' After thinking it over I agree but now aren't we risking an too much dependence on CSS? It seems a bit odd to have a CSS parser for only one job and specifying style in an html attribute is WCAG invalid. Is there a common use case?
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? +1 B
A I need to hear more about how it will be implemented, from what i read it doesn't look right.
As Thomas said, it will be implemented in a XWiki specific implementation of WikiModel ( http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-rendering/xwiki... ). We're going to add a method to get the image URL based on: document reference, attachment file name and image parameters. The implementation looks for the width, height and style parameters and tries to extract image width/height from them. If it succeeds then it adds this information to the query string of the attachment download URL. When the image is requested by the browser the image plugin is called and it uses the width and height request parameters (if specified) to scale the image attachment. The image size is never increased. The image plugin uses a component for image processing (decode, scale, encode). The default implementation of this component uses javax.imageio and java.awt classes for image processing.
Thanks for your feedback, Marius
Caleb
Thanks, Marius
[1] http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-core/src/main/j... _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
Marius Dumitru Florea wrote:
Hi Caleb,
On 09/09/2010 02:22 AM, Caleb James DeLisle wrote:
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
This seems to be fuzzing the line between url parameters and html tag attributes. why not just use [[image:logo.jpg?width=100px]]
First of all, you make the assumption that users know what a URL query string is. I don't fully agree with this. Then some users might get confused if there are two ways of specifying image width/height: should we put the width/height in the image reference or in the image parameters? Finally, writing:
[[image:logo.jpg?width=100||width=50px]]
makes no sense. Why would you want to download a 100px image when you display it at 50px only.
Also, IMO wiki syntax is independent from HTML. When you write:
[[image:logo.jpg||width="100px"]]
"width" is a parameter of the image. This wiki syntax could be rendered in many formats. One of these formats is HTML, but it's not the only one. When rendered in HTML the width parameter is mapped to the width HTML image attribute but that doesn't mean we can't use the width parameter for other things, like adjusting the image URL.
IMO what's really important is to honor user expectations. When a user writes:
[[image:logo.jpg||width="100px"]]
he expects to see the logo.jpg image displayed and its width to be 100px. My proposal doesn't change this. Resizing the image on the server is an optimization and I think most of the users will be happy with it (the page will load faster).
I can see the logic in this. +1
and
[[image:logo.jpg||style="height: 50px; width: 70px"]]
will be linked to
/xwiki/bin/download/Spage/Page/logo.jpg?width=70&height=50
Parsing CSS and extracting widths and heights for server side scaling?
Yes, using http://cssparser.sourceforge.net/ .
'IMO wiki syntax is independent from HTML. When you write [...] "width" is a parameter of the image. This wiki syntax could be rendered in many formats.' After thinking it over I agree but now aren't we risking an too much dependence on CSS? It seems a bit odd to have a CSS parser for only one job and specifying style in an HTML attribute is WCAG invalid. Is there a common use case?
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? +1 B
A I need to hear more about how it will be implemented, from what i read it doesn't look right.
As Thomas said, it will be implemented in a XWiki specific implementation of WikiModel ( http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-rendering/xwiki... ). We're going to add a method to get the image URL based on: document reference, attachment file name and image parameters. The implementation looks for the width, height and style parameters and tries to extract image width/height from them. If it succeeds then it adds this information to the query string of the attachment download URL. When the image is requested by the browser the image plugin is called and it uses the width and height request parameters (if specified) to scale the image attachment. The image size is never increased. The image plugin uses a component for image processing (decode, scale, encode). The default implementation of this component uses javax.imageio and java.awt classes for image processing.
Thanks for your feedback, Marius
Caleb
Thanks, Marius
[1] http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-core/src/main/j... _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
On 09/09/2010 12:18 PM, Caleb James DeLisle wrote:
Marius Dumitru Florea wrote:
Hi Caleb,
On 09/09/2010 02:22 AM, Caleb James DeLisle wrote:
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
This seems to be fuzzing the line between url parameters and html tag attributes. why not just use [[image:logo.jpg?width=100px]]
First of all, you make the assumption that users know what a URL query string is. I don't fully agree with this. Then some users might get confused if there are two ways of specifying image width/height: should we put the width/height in the image reference or in the image parameters? Finally, writing:
[[image:logo.jpg?width=100||width=50px]]
makes no sense. Why would you want to download a 100px image when you display it at 50px only.
Also, IMO wiki syntax is independent from HTML. When you write:
[[image:logo.jpg||width="100px"]]
"width" is a parameter of the image. This wiki syntax could be rendered in many formats. One of these formats is HTML, but it's not the only one. When rendered in HTML the width parameter is mapped to the width HTML image attribute but that doesn't mean we can't use the width parameter for other things, like adjusting the image URL.
IMO what's really important is to honor user expectations. When a user writes:
[[image:logo.jpg||width="100px"]]
he expects to see the logo.jpg image displayed and its width to be 100px. My proposal doesn't change this. Resizing the image on the server is an optimization and I think most of the users will be happy with it (the page will load faster).
I can see the logic in this. +1
and
[[image:logo.jpg||style="height: 50px; width: 70px"]]
will be linked to
/xwiki/bin/download/Spage/Page/logo.jpg?width=70&height=50
Parsing CSS and extracting widths and heights for server side scaling?
Yes, using http://cssparser.sourceforge.net/ .
'IMO wiki syntax is independent from HTML. When you write [...] "width" is a parameter of the image. This wiki syntax could be rendered in many formats.'
After thinking it over I agree but now aren't we risking an too much dependence on CSS? It seems a bit odd to have a CSS parser for only one job and specifying style in an html attribute is WCAG invalid. Is there a common use case?
Right now the common use case is when a user resizes an image from the WYSIWYG editor using the image resize handlers. The browser puts the width and height information in the style attribute. I can move the width and height to the corresponding attributes afterwards but: * The style attribute is still required when width and height are not expressed in pixel or percent. This won't happen often but the user can explicitly set the width/height to other units like em in the edit image WYSIWYG wizard. * The user can still write: [[image:logo.jpg||style="height: 50px; width: 70px"]] in the wiki editor and the image will be displayed as expected. I admit that the style parameter for image syntax (and not only) is HTML oriented but I think it's ok to parse it in order to optimize page loading speed. Thanks, Marius
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? +1 B
A I need to hear more about how it will be implemented, from what i read it doesn't look right.
As Thomas said, it will be implemented in a XWiki specific implementation of WikiModel ( http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-rendering/xwiki... ). We're going to add a method to get the image URL based on: document reference, attachment file name and image parameters. The implementation looks for the width, height and style parameters and tries to extract image width/height from them. If it succeeds then it adds this information to the query string of the attachment download URL. When the image is requested by the browser the image plugin is called and it uses the width and height request parameters (if specified) to scale the image attachment. The image size is never increased. The image plugin uses a component for image processing (decode, scale, encode). The default implementation of this component uses javax.imageio and java.awt classes for image processing.
Thanks for your feedback, Marius
Caleb
Thanks, Marius
[1] http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-core/src/main/j... _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
Marius Dumitru Florea wrote:
On 09/09/2010 12:18 PM, Caleb James DeLisle wrote:
Marius Dumitru Florea wrote:
Hi Caleb,
On 09/09/2010 02:22 AM, Caleb James DeLisle wrote:
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 This seems to be fuzzing the line between url parameters and html tag attributes. why not just use [[image:logo.jpg?width=100px]] First of all, you make the assumption that users know what a URL query string is. I don't fully agree with this. Then some users might get confused if there are two ways of specifying image width/height: should we put the width/height in the image reference or in the image parameters? Finally, writing:
[[image:logo.jpg?width=100||width=50px]]
makes no sense. Why would you want to download a 100px image when you display it at 50px only.
Also, IMO wiki syntax is independent from HTML. When you write:
[[image:logo.jpg||width="100px"]]
"width" is a parameter of the image. This wiki syntax could be rendered in many formats. One of these formats is HTML, but it's not the only one. When rendered in HTML the width parameter is mapped to the width HTML image attribute but that doesn't mean we can't use the width parameter for other things, like adjusting the image URL.
IMO what's really important is to honor user expectations. When a user writes:
[[image:logo.jpg||width="100px"]]
he expects to see the logo.jpg image displayed and its width to be 100px. My proposal doesn't change this. Resizing the image on the server is an optimization and I think most of the users will be happy with it (the page will load faster). I can see the logic in this. +1
and
[[image:logo.jpg||style="height: 50px; width: 70px"]]
will be linked to
/xwiki/bin/download/Spage/Page/logo.jpg?width=70&height=50 Parsing CSS and extracting widths and heights for server side scaling? Yes, using http://cssparser.sourceforge.net/ . 'IMO wiki syntax is independent from HTML. When you write [...] "width" is a parameter of the image. This wiki syntax could be rendered in many formats.'
After thinking it over I agree but now aren't we risking an too much dependence on CSS? It seems a bit odd to have a CSS parser for only one job and specifying style in an html attribute is WCAG invalid. Is there a common use case?
Right now the common use case is when a user resizes an image from the WYSIWYG editor using the image resize handlers. The browser puts the width and height information in the style attribute. I can move the width and height to the corresponding attributes afterwards but:
* The style attribute is still required when width and height are not expressed in pixel or percent. This won't happen often but the user can explicitly set the width/height to other units like em in the edit image WYSIWYG wizard. * The user can still write:
[[image:logo.jpg||style="height: 50px; width: 70px"]]
in the wiki editor and the image will be displayed as expected.
I admit that the style parameter for image syntax (and not only) is HTML oriented but I think it's ok to parse it in order to optimize page loading speed.
It still doesn't sound right to me but I'll trust your judgment here. 0 Caleb
Thanks, Marius
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? +1 B A I need to hear more about how it will be implemented, from what i read it doesn't look right. As Thomas said, it will be implemented in a XWiki specific implementation of WikiModel ( http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-rendering/xwiki... ). We're going to add a method to get the image URL based on: document reference, attachment file name and image parameters. The implementation looks for the width, height and style parameters and tries to extract image width/height from them. If it succeeds then it adds this information to the query string of the attachment download URL. When the image is requested by the browser the image plugin is called and it uses the width and height request parameters (if specified) to scale the image attachment. The image size is never increased. The image plugin uses a component for image processing (decode, scale, encode). The default implementation of this component uses javax.imageio and java.awt classes for image processing.
Thanks for your feedback, Marius
Caleb
Thanks, Marius
[1] http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-core/src/main/j... _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
On 09/09/2010 02:14 PM, Caleb James DeLisle wrote:
Marius Dumitru Florea wrote:
On 09/09/2010 12:18 PM, Caleb James DeLisle wrote:
Marius Dumitru Florea wrote:
Hi Caleb,
On 09/09/2010 02:22 AM, Caleb James DeLisle wrote:
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
This seems to be fuzzing the line between url parameters and html tag attributes. why not just use [[image:logo.jpg?width=100px]]
First of all, you make the assumption that users know what a URL query string is. I don't fully agree with this. Then some users might get confused if there are two ways of specifying image width/height: should we put the width/height in the image reference or in the image parameters? Finally, writing:
[[image:logo.jpg?width=100||width=50px]]
makes no sense. Why would you want to download a 100px image when you display it at 50px only.
Also, IMO wiki syntax is independent from HTML. When you write:
[[image:logo.jpg||width="100px"]]
"width" is a parameter of the image. This wiki syntax could be rendered in many formats. One of these formats is HTML, but it's not the only one. When rendered in HTML the width parameter is mapped to the width HTML image attribute but that doesn't mean we can't use the width parameter for other things, like adjusting the image URL.
IMO what's really important is to honor user expectations. When a user writes:
[[image:logo.jpg||width="100px"]]
he expects to see the logo.jpg image displayed and its width to be 100px. My proposal doesn't change this. Resizing the image on the server is an optimization and I think most of the users will be happy with it (the page will load faster).
I can see the logic in this. +1
and
[[image:logo.jpg||style="height: 50px; width: 70px"]]
will be linked to
/xwiki/bin/download/Spage/Page/logo.jpg?width=70&height=50
Parsing CSS and extracting widths and heights for server side scaling?
Yes, using http://cssparser.sourceforge.net/ .
'IMO wiki syntax is independent from HTML. When you write [...] "width" is a parameter of the image. This wiki syntax could be rendered in many formats.'
After thinking it over I agree but now aren't we risking an too much dependence on CSS? It seems a bit odd to have a CSS parser for only one job and specifying style in an html attribute is WCAG invalid. Is there a common use case?
Right now the common use case is when a user resizes an image from the WYSIWYG editor using the image resize handlers. The browser puts the width and height information in the style attribute. I can move the width and height to the corresponding attributes afterwards but:
* The style attribute is still required when width and height are not expressed in pixel or percent. This won't happen often but the user can explicitly set the width/height to other units like em in the edit image WYSIWYG wizard. * The user can still write:
[[image:logo.jpg||style="height: 50px; width: 70px"]]
in the wiki editor and the image will be displayed as expected.
I admit that the style parameter for image syntax (and not only) is HTML oriented but I think it's ok to parse it in order to optimize page loading speed.
It still doesn't sound right to me but I'll trust your judgment here.
0
Caleb
I think the best way would be to have this configurable in, for example, xwikipreferences. This way, it wouldn't sound "wrong" from an architectural point of view anymore, imo. +1 Dan
Thanks, Marius
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?
+1 B A I need to hear more about how it will be implemented, from what i read it doesn't look right.
As Thomas said, it will be implemented in a XWiki specific implementation of WikiModel ( http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-rendering/xwiki... ). We're going to add a method to get the image URL based on: document reference, attachment file name and image parameters. The implementation looks for the width, height and style parameters and tries to extract image width/height from them. If it succeeds then it adds this information to the query string of the attachment download URL. When the image is requested by the browser the image plugin is called and it uses the width and height request parameters (if specified) to scale the image attachment. The image size is never increased. The image plugin uses a component for image processing (decode, scale, encode). The default implementation of this component uses javax.imageio and java.awt classes for image processing.
Thanks for your feedback, Marius
Caleb
Thanks, Marius
[1] http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-core/src/main/j... _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
On 09/09/2010 11:30 PM, Dan Bozaru wrote:
On 09/09/2010 02:14 PM, Caleb James DeLisle wrote:
Marius Dumitru Florea wrote:
On 09/09/2010 12:18 PM, Caleb James DeLisle wrote:
Marius Dumitru Florea wrote:
Hi Caleb,
On 09/09/2010 02:22 AM, Caleb James DeLisle wrote:
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 > This seems to be fuzzing the line between url parameters and html tag attributes. why not just use [[image:logo.jpg?width=100px]]
First of all, you make the assumption that users know what a URL query string is. I don't fully agree with this. Then some users might get confused if there are two ways of specifying image width/height: should we put the width/height in the image reference or in the image parameters? Finally, writing:
[[image:logo.jpg?width=100||width=50px]]
makes no sense. Why would you want to download a 100px image when you display it at 50px only.
Also, IMO wiki syntax is independent from HTML. When you write:
[[image:logo.jpg||width="100px"]]
"width" is a parameter of the image. This wiki syntax could be rendered in many formats. One of these formats is HTML, but it's not the only one. When rendered in HTML the width parameter is mapped to the width HTML image attribute but that doesn't mean we can't use the width parameter for other things, like adjusting the image URL.
IMO what's really important is to honor user expectations. When a user writes:
[[image:logo.jpg||width="100px"]]
he expects to see the logo.jpg image displayed and its width to be 100px. My proposal doesn't change this. Resizing the image on the server is an optimization and I think most of the users will be happy with it (the page will load faster).
I can see the logic in this. +1
> and > > [[image:logo.jpg||style="height: 50px; width: 70px"]] > > will be linked to > > /xwiki/bin/download/Spage/Page/logo.jpg?width=70&height=50 > Parsing CSS and extracting widths and heights for server side scaling?
Yes, using http://cssparser.sourceforge.net/ .
'IMO wiki syntax is independent from HTML. When you write [...] "width" is a parameter of the image. This wiki syntax could be rendered in many formats.'
After thinking it over I agree but now aren't we risking an too much dependence on CSS? It seems a bit odd to have a CSS parser for only one job and specifying style in an html attribute is WCAG invalid. Is there a common use case?
Right now the common use case is when a user resizes an image from the WYSIWYG editor using the image resize handlers. The browser puts the width and height information in the style attribute. I can move the width and height to the corresponding attributes afterwards but:
* The style attribute is still required when width and height are not expressed in pixel or percent. This won't happen often but the user can explicitly set the width/height to other units like em in the edit image WYSIWYG wizard. * The user can still write:
[[image:logo.jpg||style="height: 50px; width: 70px"]]
in the wiki editor and the image will be displayed as expected.
I admit that the style parameter for image syntax (and not only) is HTML oriented but I think it's ok to parse it in order to optimize page loading speed.
It still doesn't sound right to me but I'll trust your judgment here.
0
Caleb
I think the best way would be to have this configurable in, for example, xwikipreferences. This way, it wouldn't sound "wrong" from an architectural point of view anymore, imo.
Are you referring to the parsing of the style parameter or to the modification of the image URL to include the width/height information? I'm fine with adding a configuration parameter to be able to disable the server side resizing of images, but I don't think a parameter for disabling the parsing of the style attribute is really useful. Thanks for your feedback, Marius
+1
Dan
Thanks, Marius
> 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? > +1 B A I need to hear more about how it will be implemented, from what i read it doesn't look right.
As Thomas said, it will be implemented in a XWiki specific implementation of WikiModel ( http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-rendering/xwiki... ). We're going to add a method to get the image URL based on: document reference, attachment file name and image parameters. The implementation looks for the width, height and style parameters and tries to extract image width/height from them. If it succeeds then it adds this information to the query string of the attachment download URL. When the image is requested by the browser the image plugin is called and it uses the width and height request parameters (if specified) to scale the image attachment. The image size is never increased. The image plugin uses a component for image processing (decode, scale, encode). The default implementation of this component uses javax.imageio and java.awt classes for image processing.
Thanks for your feedback, Marius
Caleb
> Thanks, > Marius > > [1] > http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-core/src/main/j... > _______________________________________________ > users mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/users > > _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
On 09/09/2010 10:25 AM, Marius Dumitru Florea wrote:
On 09/09/2010 12:08 AM, Anca Luca wrote:
On 09/08/2010 11: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
If I remember correctly this would mean that we give special meaning to some parameters (right now they are automatically copied to HTML attributes of the element). I don't remember exactly why, but I think this was an issue (Thomas? Vincent?)
otherwise I would be +1 for this, image will be resized anyway, and let's hope the image plugin can do it as well as the browser would (in terms of quality of the result).
For jpeg images there is the quality parameter that is configurable so you can set it to a value closer to 1 to preserve image quality.
Also, I'm refactoring the image plugin to use a component for image processing. The default implementation will use javax.imageio and java.awt for decoding, scaling and encoding images. If you are not satisfied with the result you should be able to write a custom implementation using third party image processing libraries.
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 would say we would need a way to bypass and say "original size", be it a special value of the width (negative) or another method.
If the image width/height limit is reasonable for a web page (you can't expect to display 3640x2736 images on the web) then you won't have to view the original image most of the time. And if you do want to view the original image then you can specify the (original) image width/height to bypass the limit (since this won't happen often it won't be an overhead for the user).
yes, but I'm talking about the situation when you don't know the image width and height, for example if a script generates the syntax. I think in general is not a good idea to prevent the users from getting the original image, even if in most of the cases it's not that useful. If the users know what they're doing, they should be able to, with a special param or something, just as a general policy. Thanks, Anca
Limiting the image width/height is very useful when users attach photos without resizing them first to a web-friendly width/height. Instead of downloading a few MB you'll be downloading just a few KB.
Thanks for your feedback, Marius
+0 for B
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... _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
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?
(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?
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...
-- Sergiu Dumitriu http://purl.org/net/sergiu/
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?
(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]] 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...
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?
(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...
-- Sergiu Dumitriu http://purl.org/net/sergiu/
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...
participants (7)
-
Anca Luca -
Caleb James DeLisle -
Dan Bozaru -
Ecaterina Valica -
Marius Dumitru Florea -
Sergiu Dumitriu -
Thomas Mortagne