cf_image_watermark is a quick solution to add text and graphical watermark over an image, on-the-fly. Using built-in Java provided by CFMX, this custom tag requires no CFX installation. Just put the custom tag on the working directory, and you're on!
New in V2: Better support for GIF and PNG files which have alpha layer (transparent). Better error handling. CF_Image_Watermark will now throws an error whenever incorrect parameter was supplied. The caller page can trap the error message in <cftry><cfcatch> block.
New in V3: Support ColdFusion 8
*** Requirements: ColdFusion MX and up
*** Usage: <cf_image_watermark InputImageFile="Full path and filename for the image to be resized (mandatory). Accepted format: jpg, png, gif" OutputImageFile="Full path and filename for resulting image (mandatory). Allowable format: jpg, png" WaterMarkImageFile="Full path and filename for watermark image. Accepted format: jpg, png, gif" WaterMarkText="Text you want to put over the image" WaterMarkFontFace="The typeface of the font, such as: Arial, Times New Roman. Depends on fonts available in the server." WaterMarkFontSize="The size of the font" WaterMarkFontStyle="plain/bold/italic/bolditalic" WaterMarkFontColor="Color of the text in hex triplet, such as: 000000, FFFFFF" X="absolute X coordinate for watermarkimage and/or text" Y="absolute Y coordinate for watermarkimage and/or text" Align="horizontal alignment (NULL/left/center/right" VAlign="vertical alignment (NULL/top/center/bottom" HMargin="horizontal margin in pixels" VMargin="vertical margin in pixels" Quality="JPEG compression quality (0-100) 0 is the worst quality while 100 has the best quality" Opacity="Opacity level (0-100). 0=transparent, 100=opaque">
Explanation: 1. WaterMarkImage and WaterMarkText. You have to specify either WaterMarkImage or WaterMarkText, or both. These are images and text you want to put over the original image 2. X,Y Absolute coordinate. You will need to use these attributes if you want to put the WaterMarkImage and WaterMarkText in specific coordinate, rather than using Align or Valign 3. Align,Valign These attributes is to set the alignment of WaterMarkImage and WaterMarkText. You will need this if you want to put the watermark automatically, without specifying exact X/Y coordinate. For example: If you want to put the watermark on bottom right of image, you will put these values: Align="right" VAlign="bottom" 4. HMargin, VMargin Works in conjuction with Align and VAlign. These attributes determine the margin for watermark. For example: If you want the watermark to be 10 pixels away from the right edge, and on the center image, you will use these values: Align="right" Valign="center" HMargin="10" VMargin="0"
*** Examples: For a complete usage example, please browse: http://www.masrizal.com/index.cfm?fuseaction=idea.download_detail&ProductID=cf_image_watermark
*** Updates: v1.1: Added opacity level Many thanks goes to Michael Tyler from Forumsigs Image Hosting (http://www.forumsigs.com) for requesting this important feature. v1.0.1: Unix bug fix. Now the example works fine in UNIX system. Many thanks goes to Peter Kates and Dima Svirid for letting us know about this bug.
|