Custom Tag: cf_image_resize Version: 3.0 (c) 2007, Rizal Firmansyah, rizal.firmansyah@masrizal.com Disclaimer: This custom tag was written to help developers resize image easily on-the-fly. This custom tag comes with a very low price. I believe the price of this custom tag is less than an average 1 hour programmers rate. But by using this custom tag, you save lots of your valuable time writing CF and Java code to produce the same result. For full license and disclaimer about this tag, please read: license.txt ------------------------------------------------------------------------------- cf_image_resize is a quick solution to resize an image easily, on-the-fly. *** Requirements: ColdFusion MX 6, ColdFusion 7 and ColdFusion 8 *** Usage: Explanation: 1. ToWidth and ToHeight determine the exact size of resulting image. You can specify these values as pixels or as percentage. For example: Towidth="100" or Towidth="50%" To resize proportionally you can set these values to the same percentage value. 2. MaxWidth and MaxHeight determine the maximum size of resulting image, in pixels. You will these attributes if you want the resulting image to have a specific maximum width or height. For example: If you put towidth="50%" and toheight="50%" and the original image size is 1000x1000 pixels, the resulting image will be 500x500 pixels. But if you want the max image to be 100x200, then you can set MaxWidth="100 and MaxHeight="200", and the resulting image will be resized proportionally based on those maximum values. 3. IfInputLargerOnly Set this value to "yes" or "true" or "1" and specify MaxWidth and MaxHeight if you want to resize the original image only if the original image is larger than MaxWidth and MaxHeight. If the original image is smaller than MaxWidth and MaxHeight, the resulting image will be the same like the input image. 4. Another way to set proportional resize is to put 0 either in ToWidth/ToHeight or MaxWidth/MaxHeight. Eg: ToWidth=0 ToHeight=100 will set the resulting image to 100px tall, and the width will be resized proportionally. Eg: MaxWidth=300 ToHeight=0 will set the resulting image to maximum 300px wide, and the height will be resized proportionally. 5. New on V2: Better support for GIF and PNG files which have alpha layer (transparent). Better error handling. CF_Image_Resize will now throws an error whenever incorrect parameter was supplied. The caller page can trap the error message in block. *** Examples: For a complete usage example, please check "\docs & examples\example.cfm" ------------------------------------------------------------------------------- Hope you find this tag useful. Sincerely, MasRizal & Partners http://www.masrizal.com