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 -->
<img class="float-${content.imgAlignment}" alt="${content.imgAlt}"
src="${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 -->
<img class="float-${content.imgAlignment}" alt="${content.imgAlt}"
src="${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]>
----------------------------------------------------------------