[xwiki-devs] [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...
+1 On Wed, Sep 8, 2010 at 22:40, Marius Dumitru Florea <[email protected]> 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/j... _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne
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/j... _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
Hi Alex, On 09/09/2010 11:35 PM, Alex Busenius wrote:
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"]]
I don't understand why do you say the syntax is ambiguous. I guess you consider XHTML syntax ambiguous too, because: <img src="logo.jpg" alt="logo" width="100px" height="50%" style="width: 45%; height: 100px" /> is perfectly valid. You can specify image size either using the attributes or using CSS (be it in-line, though the style attribute, or in a style sheet). CSS (both in-line and style sheet) always takes precedence over the size attributes. Thus in your example, the final image size in the browser is 45% x 100px. Note that there is a difference in what you can specify with the size attributes and what you can specify with CSS: width/height attributes accept only pixels or percent, so CSS (i.e. the style attribute) is more powerful.
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?
If the unit ( http://www.w3schools.com/css/css_units.asp ) of width/height is not pixel then I continue as if the width/height hasn't been specified. For instance, if image width/height limit is set to 800x600 in configuration then: width:30%; height:3cm => ?width=800&height=600&keepAspectRatio=true width:70px; height:3in => ?width=70 width:6em; height:20px => ?height=20 width:35px; height:15px => ?width=35&height=15
What if pixel and percent numbers are mixed (e.g. width is in px and height in %)?
Only the dimension expressed in pixels is used. Width and height are "read" from image parameters independent of each other.
What takes precedence, width attribute or CSS style attribute?
Always the CSS (be it in-line or from a style sheet).
Will the size information XWiki uses to resize images be the same as various browsers use to display the image?
Most of the time the image will be resized just once, on the server. There are some cases though when the image will be resized both on the server and on the client (by the browser). For instance: * if width and height are not expressed in pixels then the server will limit the image size based on configuration and the browser will resize the image based on specified width/height * if one of the dimensions is expressed in pixels and the other in percent (or any other unit different than pixel) then the server will scale the image using the pixel dimension and the browser will adjust the other based on the specified value. * if width and height are specified in pixels but there is an external style sheet that enforces a different image size then the server will scale the image based on the specified width/height and the browser will resize the returned image based on the external style sheet.
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.
I think you are referring to the XHTML renderer here, but my change targets all the renderers. A renderer doesn't know how to assemble the URL for an attachment or a document so it asks the WikiModel. Thomas and I discussed about adding a: String getImageURL(String documentName, String fileName, Map<String, String> parameters) method to WikiModel, that can be used by any renderer. XWikiWikiModel (our implementation) will look at the passed parameters map and if image width/height is specified them it will add this information to the query string of the attachment download URL. The fact that we look for the "width", "height" and "style" parameters is a convention. It's not related to HTML. The fact that the style image parameter contains CSS is also unrelated to HTML (CSS can be used on other types of structured content). Regarding copy-pasting custom parameters from XWiki syntax to the rendered HTML (by the XHTML renderer) I don't have a strong opinion. I don't see why it is bad from security PoV. I'll let Thomas and Vincent comment on this.
Since your change would introduce parsing for the parameters, it might be a good point to start going into this direction, WDYT?
This needs to be discussed in a separate thread. Thanks for your feedback, Marius
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/j... _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
Hi Marius, On 09/10/2010 02:52 PM, Marius Dumitru Florea wrote:
Hi Alex,
On 09/09/2010 11:35 PM, Alex Busenius wrote:
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"]]
I don't understand why do you say the syntax is ambiguous. I guess you consider XHTML syntax ambiguous too, because:
Yes, thats what I meant.
<img src="logo.jpg" alt="logo" width="100px" height="50%" style="width: 45%; height: 100px" />
is perfectly valid. You can specify image size either using the attributes or using CSS (be it in-line, though the style attribute, or in a style sheet). CSS (both in-line and style sheet) always takes precedence over the size attributes. Thus in your example, the final image size in the browser is 45% x 100px. Note that there is a difference in what you can specify with the size attributes and what you can specify with CSS: width/height attributes accept only pixels or percent, so CSS (i.e. the style attribute) is more powerful.
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?
If the unit ( http://www.w3schools.com/css/css_units.asp ) of width/height is not pixel then I continue as if the width/height hasn't been specified. For instance, if image width/height limit is set to 800x600 in configuration then:
width:30%; height:3cm => ?width=800&height=600&keepAspectRatio=true
width:70px; height:3in => ?width=70
width:6em; height:20px => ?height=20
width:35px; height:15px => ?width=35&height=15
Ok, makes sense.
What if pixel and percent numbers are mixed (e.g. width is in px and height in %)?
Only the dimension expressed in pixels is used. Width and height are "read" from image parameters independent of each other.
I see.
What takes precedence, width attribute or CSS style attribute?
Always the CSS (be it in-line or from a style sheet).
Ok.
Will the size information XWiki uses to resize images be the same as various browsers use to display the image?
Most of the time the image will be resized just once, on the server. There are some cases though when the image will be resized both on the server and on the client (by the browser). For instance:
* if width and height are not expressed in pixels then the server will limit the image size based on configuration and the browser will resize the image based on specified width/height
* if one of the dimensions is expressed in pixels and the other in percent (or any other unit different than pixel) then the server will scale the image using the pixel dimension and the browser will adjust the other based on the specified value.
* if width and height are specified in pixels but there is an external style sheet that enforces a different image size then the server will scale the image based on the specified width/height and the browser will resize the returned image based on the external style sheet.
Sounds reasonable.
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.
I think you are referring to the XHTML renderer here, but my change targets all the renderers. A renderer doesn't know how to assemble the URL for an attachment or a document so it asks the WikiModel. Thomas and I discussed about adding a:
String getImageURL(String documentName, String fileName, Map<String, String> parameters)
method to WikiModel, that can be used by any renderer. XWikiWikiModel (our implementation) will look at the passed parameters map and if image width/height is specified them it will add this information to the query string of the attachment download URL. The fact that we look for the "width", "height" and "style" parameters is a convention. It's not related to HTML. The fact that the style image parameter contains CSS is also unrelated to HTML (CSS can be used on other types of structured content).
Regarding copy-pasting custom parameters from XWiki syntax to the rendered HTML (by the XHTML renderer) I don't have a strong opinion. I don't see why it is bad from security PoV. I'll let Thomas and Vincent comment on this.
Since your change would introduce parsing for the parameters, it might be a good point to start going into this direction, WDYT?
This needs to be discussed in a separate thread.
Yes, this is a larger topic, to be discussed later. +1 for A and B Thanks, Alex
Thanks for your feedback, Marius
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/j... _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
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...
On 09/21/2010 08:41 PM, Marius Dumitru Florea wrote:
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.
+ I would say the same, middle.
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...
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
Just curious, will there be an option preserved to stick with the old behaviour (i.e. no server-side resizing even if there are height and width parameters specified) ? The simple reason is that we are doing all of our documentation, screenshots e.t.c this way and come up with thumbnails on the page but link them to lightboxes to make them appear fullsize just in case you want to see the details ... I'm just wondering how then we will have to specify this use case with future releases ... kind regards Andreas Am 08.09.2010 22:40, schrieb Marius Dumitru Florea:
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... _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
Hi Andreas, On 09/23/2010 10:10 AM, Andreas Hahn wrote:
Just curious, will there be an option preserved to stick with the old behaviour (i.e. no server-side resizing even if there are height and width parameters specified) ? The simple reason is that we are doing all of our documentation, screenshots e.t.c this way and come up with thumbnails on the page but link them to lightboxes to make them appear fullsize just in case you want to see the details ... I'm just wondering how then we will have to specify this use case with future releases ...
Sure, you can set: rendering.imageDimensionsIncludedInImageURL = false (it's true by default) in xwiki.properties configuration file. Note that the new behavior applies only to images included using the xwiki/2.0 syntax, if at least one of the image dimensions are specified: [[image:picture.png||width="150px"]] So if you include images in a different way (e.g. xwiki/1.0 syntax or HTML syntax) then you shouldn't be affected. In other words, if you control the image URL and you don't specify image dimensions in the query string then the original image will be loaded. Now, you say that you display thumbnails on the page and when the user clicks them the full size image is displayed. Are the thumbnails generated on the server or are they in fact the original images resized by the browser? Couldn't you use the new behavior for displaying the thumbnails and then use the image URL without the query string to load the full size image in the light box? This way users that are not interested in the details don't have to download full size images when viewing the page. An example of this behavior, without the light box is: [[[[image:picture.png||width="150px"]]>>attach:picture.png]] Hope this helps, Marius
kind regards
Andreas
Am 08.09.2010 22:40, schrieb Marius Dumitru Florea:
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... _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
Hi Marius, I see. Thx a lot for explanation and the esample. Andreas Am 23.09.2010 10:12, schrieb Marius Dumitru Florea:
Hi Andreas,
On 09/23/2010 10:10 AM, Andreas Hahn wrote:
Just curious, will there be an option preserved to stick with the old behaviour (i.e. no server-side resizing even if there are height and width parameters specified) ? The simple reason is that we are doing all of our documentation, screenshots e.t.c this way and come up with thumbnails on the page but link them to lightboxes to make them appear fullsize just in case you want to see the details ... I'm just wondering how then we will have to specify this use case with future releases ...
Sure, you can set:
rendering.imageDimensionsIncludedInImageURL = false
(it's true by default) in xwiki.properties configuration file.
Note that the new behavior applies only to images included using the xwiki/2.0 syntax, if at least one of the image dimensions are specified:
[[image:picture.png||width="150px"]]
So if you include images in a different way (e.g. xwiki/1.0 syntax or HTML syntax) then you shouldn't be affected. In other words, if you control the image URL and you don't specify image dimensions in the query string then the original image will be loaded.
Now, you say that you display thumbnails on the page and when the user clicks them the full size image is displayed. Are the thumbnails generated on the server or are they in fact the original images resized by the browser? Couldn't you use the new behavior for displaying the thumbnails and then use the image URL without the query string to load the full size image in the light box? This way users that are not interested in the details don't have to download full size images when viewing the page.
An example of this behavior, without the light box is:
[[[[image:picture.png||width="150px"]]>>attach:picture.png]]
Hope this helps, Marius
kind regards
Andreas
Am 08.09.2010 22:40, schrieb Marius Dumitru Florea:
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... _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
participants (6)
-
Alex Busenius -
Anca Luca -
Andreas Hahn -
Marius Dumitru Florea -
Sergiu Dumitriu -
Thomas Mortagne