Nice!   +1


On Thursday, August 21, 2003, at 01:58 PM, Rob Oxspring wrote:

First up, sorry for no unit tests - just doing enough to get by for now :)

Anyway, I was using the image task to create thumbnails and couldn't figure out how to keep proportions of an image but keep it within a fixed size. My solution was to change the keepproportions attribute to be a little cleverer. The keepproportions attribute is no more and has been replaced by the proportions attribute has been added with the following features:

proportions="ignore" - treat the dimensions independantly (==keepproportions="false" and is default)
proportions="width" - keep proportions based on the width (==keepproportions="true")
proportions="height" - keep proportions based on the height
proportions="fit" - keep proportions and fit in the supplied dimensions
proportions="cover" - keep proportions and cover the supplied dimensions


So for example I can use the following to create thumbnails of my images and make sure they all fit within the 160x160 size whether the image is portrait or landscape.

<image destdir="samples/low" overwrite="yes">
    <fileset dir="samples/full">
        <filename name="**/*.jpg"/>
    </fileset>
    <scale width="160" height="160" proportions="fit"/>
</image>

Hope that's helpful to others,

Rob

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to