My work wasn't official or anything. I coded the tag in to my project because my authors shouldn't need to know how to change the size of an image or what size is a good one. Just edit till it looks good. After a few edits they'll get a feel for good image sizes.

In testing I found out how broken the tag was. My implementation made a number of changes:

1. Where the original attempted to first create a contentNode and then a String type nodeData (the default) inside it, my code just creates a binary type nodeData in the paragraph. Benefit of this is the cmsu:img can still be used without modification.

2. Where the original appears to only generate .png files, my code attempts to match mime type (limited to .gif, .jpg, .png). JDKs 1.4 and up should handle this with no additional libraries. I did this because some older browsers will have problems with png file format and my visitors might not have the resources for an up-to-date computer and browser.

3. On execution, the last mod date of the scaled image is compared to the last mod date of it's parent contentNode. If the parent's last mod date is more recent, the image is re-scaled.

I honestly didn't even look at BaseImageTag to see what it brought to the table. I just needed to get scaleImage to work correctly for the current project. Given the CPU expense of the tag, it might be best if it runs in a cms:adminOnly tag to save the public site from the cost of scaling a large image down.

I'll send you a copy of my scale image class and maybe we can get a single patch with the best of both submitted.

--David

Tom Duffey wrote:

On Apr 9, 2007, at 3:21 PM, David Smith wrote:

Funny how timing works.  I just got done fixing up cmsu:scaleImage to
work as well!  We'll have to compare patches :-)

Oops, it wasn't clear in JIRA that anyone else was working on it :)

In any case, besides scaling the image I need the tag to do the following:

1) Recreate the scaled image when the source (Full size) image is updated. I had to patch BaseImageTag to update the last modification date on the scaled image node to be able to do this comparison.

2) Recreate the scaled image when the template dimensions (maxHeight or maxWidth) change. To do this comparison I am storing the requested height and width as attributes of the scaled image node.

If your patch works and handles these two cases then it's a horse a piece. The only other major change I made was to have ScaleImageTag extend BaseImageTag.

Tom

m Duffey wrote:
Hi All,

I realize the issue is marked "low priority" but is there any way you
guys can push http://jira.magnolia.info/browse/MAGNOLIA-1357 into the
next 3.0.x release or at least trunk?  The latest two patches I
supplied for BaseImageTag.java and ScaleImageTag.java are what I
consider the bare minimum for having a working scale image tag.

The patches are against 3.0.2 but should be easy to apply to trunk, it
looks like you just have to change the HierarchyManager import.  If it
helps move things along I would be glad to test these changes on trunk
and get you patches for that branch.

Best Regards,

Tom Duffey

----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/developer.html
----------------------------------------------------------------


--=======================================
David Smith
Network Operations Supervisor
Department of Entomology
College of Agriculture & Life Sciences
Cornell University
2132 Comstock Hall
Ithaca, NY  14853
Phone: 607.255.9571
Fax: 607.255.0939


----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/developer.html
----------------------------------------------------------------


----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/developer.html
----------------------------------------------------------------


----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/developer.html
----------------------------------------------------------------

Reply via email to