Ok. So after studying the out tag source code for a while I've managed to
work out (1) in my email below. The answer is just below. However, I've just
discovered that the <cmsu:scaleImage> tag is hardcoded to only support
images stored in the website repository. So (2) below can't be done unless
the <cmsu:scaleImage> is extended to accept a repository attribute. Haven't
really looked into (3) yet but if someone has done something similar please
let me know. 

The solution to (1) is:

<!-- Rescale the image to a maxWidth of 60px -->
<c:set var="imageUrl">
   <cmsu:scaleImage parentNodeDataName="imgBinary"
imageContentNodeName="sizeW60" maxWidth="60" allowOversize="false"/>
</c:set>
<cms:out contentNodeName="sizeW60" nodeDataName="imgBinary"
fileProperty="width" var="scaledImageWidth"/>
<cms:out contentNodeName="sizeW60" nodeDataName="imgBinary"
fileProperty="height" var="scaledImageHeight"/>

<!-- Display the rescaled image -->
${pageContext.request.contextPath}${imageUrl} 


Cheers,

Brent



Brent McArthur wrote:
> 
> 
> Hi There,
> 
> My last question was about displaying paragraph linked images from the
> DMS. That's now sorted and the working JSP is below. However, now I'm
> stuck on something new :)
> 
> I'm sure these two issues can be solved using the tag libraries bundled
> with Magnolia 4.0.1 but I must be doing something wrong.
> 
> What I want to do is:
> 
> 1. Rescale an image that is embedded in the paragraph content and then
> display it using the correct width="?" and height="?" IMG attributes. As
> you can see at the bottom of this email, I have the image displaying but
> I'm relying on the browser to render it at the correct size. I can get the
> width and height of the original image easily using this expression:
> 
>       <cms:out nodeDataName="imgBinary" fileProperty="width" var="imageWidth"
> />
>       <p>Width: ${imageWidth}</p>
> 
> But I'm not sure how to get at the 'sizeW60' content. Anyone know?
> 
> 2. I haven't worked out how I can rescale an image that the paragraph
> links to via the DMS using the UUID. Anyone know how to do this? I get
> pretty confused around the differences between nodeData and
> contentNodeData. I've tried a combination of paths and imgBinary.sizeW60
> type syntax but had no luck. Maybe if I knew the differences I would
> understand it all better?
> 
> 3. The current scaleImage creates all scaled images as PNG format that
> have pretty big file sizes. Has anyone considered extending the current
> scaleImage tag to support scaling and saving scaled images using the
> original image format (i.e. jpg?)
> 
> Cheers,
> 
> Brent
> 
> 
> <!-- -------------- textWithImage Paragraph -------------- -->
> 
> <%@ taglib prefix="cms" uri="cms-taglib" %>
> <%@ taglib prefix="cmsu" uri="cms-util-taglib" %>
> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"; %>
> 
> <cms:editBar />
> <cms:ifNotEmpty nodeDataName="imgBinary">
>       <!-- We have a binary image embedded in the paragraph content -->
> 
>       <!-- Rescale the image to a maxWidth of 60px -->
>       <c:set var="imageUrl">
>       <cmsu:scaleImage parentNodeDataName="imgBinary"
> imageContentNodeName="sizeW60" maxWidth="60" allowOversize="false"/>
>    </c:set>
> 
>    <!-- Display the rescaled image -->
>     ${pageContext.request.contextPath}${imageUrl} 
> </cms:ifNotEmpty>
> 
> <cms:ifNotEmpty nodeDataName="imgDmsUUID">
>       <!-- The paragraph links to an image in the DMS -->
> 
>       <!-- Get the URL for the linked image -->
>       <cms:out nodeDataName="imgDmsUUID" uuidToLinkRepository="dms"
> uuidToLink="absolute" var="imageUrl" />
> 
>    <!-- Display the linked image -->
>        ${pageContext.request.contextPath}${imageUrl} 
> </cms:ifNotEmpty>
> <cms:out nodeDataName="text" />
> 
> ----------------------------------------------------------------
> For list details see
> http://www.magnolia-cms.com/home/community/mailing-lists.html
> To unsubscribe, E-mail to: <[email protected]>
> ----------------------------------------------------------------
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Observation-question-tp23924219p23981824.html
Sent from the Magnolia - User mailing list archive at Nabble.com.


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to