On Sep 13, 2010, at 2:17 PM, Marius Dumitru Florea wrote:
On 09/13/2010 12:14 PM, Vincent Massol wrote:
On Sep 13, 2010, at 10:09 AM, Vincent Massol wrote:
On Sep 12, 2010, at 1:30 PM, mflorea (SVN) wrote:
Author: mflorea
Date: 2010-09-12 13:30:15 +0200 (Sun, 12 Sep 2010)
New Revision: 31053
Modified:
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/configuration/RenderingConfiguration.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/configuration/DefaultRenderingConfiguration.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/internal/renderer/xhtml/DefaultXHTMLImageRenderer.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/wiki/WikiModel.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-xwiki/pom.xml
platform/core/trunk/xwiki-rendering/xwiki-rendering-xwiki/src/main/java/org/xwiki/rendering/internal/configuration/XWikiRenderingConfiguration.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-xwiki/src/main/java/org/xwiki/rendering/internal/wiki/XWikiWikiModel.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-xwiki/src/test/java/org/xwiki/rendering/internal/configuration/XWikiRenderingConfigurationTest.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-xwiki/src/test/java/org/xwiki/rendering/internal/wiki/XWikiWikiModelTest.java
Log:
XWIKI-5479: Include image dimensions in the image URL for server side image resizing
Modified:
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/configuration/RenderingConfiguration.java
===================================================================
---
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/configuration/RenderingConfiguration.java 2010-09-11
17:15:46 UTC (rev 31052)
+++
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/java/org/xwiki/rendering/configuration/RenderingConfiguration.java 2010-09-12
11:30:15 UTC (rev 31053)
@@ -50,7 +50,7 @@
*</ul>
* Note that if the page title is empty or not defined then it defaults to %p. This is
also the case
* if the title cannot be retrieved for the document.
- *
+ *
* The default is "%p". Some examples: "%s.%p",
"%w:%s.%p".
*
* @return the format to use to display link labels when the user hasn't specified
a label
@@ -63,4 +63,42 @@
* descriptor (ie defined by the macro author) will be used
*/
Properties getMacroCategories();
+
+ /**
+ * @return {@code true} to include the image dimensions extracted from the image
parameters in the image URL,
+ * {@code false} otherwise; when image dimensions are included in the
image URL the image can be resized
+ * on the server side before being downloaded.
+ * @since 2.5M2
+ */
+ boolean isIncludeImageDimensionsInImageURL();
I think is should be better named:
isImageDimensionsIncludedInImageURL()
I haven't followed too much but why do we need a flag for this? Why not always have
the dimensions in the URL?
BTW how do I render an image that I want to
resize in the browser but without resizing it on the server?
You can't from the XWiki syntax. If the image has its width/height
specified then it is resized on the server:
[[image:logo.jpg||width="150" height="100"]]
Why would you want to download a 1024x768 image when you view it at only
150x100? If you call:
getImageURL("Space.Page", "logo.jpg", {width:'150',
height:'100'})
then you get a URL to a scaled version of logo.jpg image that has width
150 and height 100, which is IMO exactly what you are expecting.
For ex, if I want the image to be displayed in
the page but I also want to be able to give a URL to the full size image?
Currently I don't see this as a real use case. What do you want to
achieve with this? How is the user interacting with the image?
We do that all the time on
xwiki.org. We display the image reduced but if the user clicks
on it he sees the full size image.
-Vincent
As I said in a previous mail, resizing the image on
the server is an
optimization that needs to be transparent for the user. Do you think the
user cares if the image is resized on the server or on the client if the
result is almost the same?
A developer that wants to display the original image in a light box or
in a different page can still use the $doc.getAttachmentURL to get the
URL to the original, full size, image.
Thanks,
Marius
[snip]