Personal tools
Home Webmaster Resources ColdFusion ColdFusion Custom Tags WaterMark ColdFusion WaterMark

ColdFusion WaterMark

CFX_WaterMark is a ColdFusion Custom Tag that gives your application the ability to add watermarks to images. While CFX_WaterMark includes many advanced options, its basic function is to create a new image file from the original image and the watermark text or image.


CFX_WaterMark
Copyright © 2007 Universal Web Services

Purchase here.
Free trial download below.

Use
- Protect copyrighted images
- Display a logo on your images
- Display a tag line on your images
       
Examples
Image WaterMark
<CFX_WaterMark
            INPUTFILE = "myimage.jpg"
            OUTPUTFILE = "myimage-protected.jpg"
            WATERMARKIMAGE = "copyright-logo.jpg"
            IMAGEROTATION = "45"
            ALPHA = "30"
            IMAGEHORIZONTALPOS = "center"
            IMAGEVERTICALPOS = "center">

           
Text WaterMark
<CFX_WaterMark
            INPUTFILE = "myimage.jpg"
            OUTPUTFILE = "myimage-protected.jpg"
            WATERMARKTEXT = "Copyright 2006 - 2007 MyCompany Inc."
            TEXTROTATION = "30"
            FONTFACE = "Arial"
            FONTSTYLE = "italic"
            FONTSIZE = "16"
            FONTCOLOR = "FF0000"
            ALPHA = "40"
            TEXTHORIZONTALPOS = "center"
            TEXTVERTICALPOS = "bottom">
           
Repeating Image Watermark
<CFX_WaterMark
            INPUTFILE = "myimage.jpg"
            OUTPUTFILE = "myimage-protected.jpg"
            WATERMARKIMAGE = "copyright-logo.jpg"
            FILLIMAGE = "yes"
            IMAGEROTATION = "45"
            ALPHA = "30"
            FILLHORIZONTALPADDING = "30"
            FILLVERTICALPADDING = "40">

Repeating Text WaterMark
<CFX_WaterMark
            INPUTFILE = "myimage.jpg"
            OUTPUTFILE = "myimage-protected.jpg"
            WATERMARKTEXT = "Copyright 2006 - 2007 MyCompany Inc."
            FILLTEXT = "yes"
            TEXTROTATION = "30"
            FONTFACE = "Times New Roman"
            FONTSTYLE = "bold"
            FONTSIZE = "32"
            FONTCOLOR = "888888"
            ALPHA = "40"
            FILLHORIZONTALPADDING = "40"
            FILLVERTICALPADDING = "60">
           


           
Installing CFX_WaterMark

1.) Copy the WaterMark.class file into your ColdFusion java classes folder.  On Windows, this folder is usually located at:

            \CFusion\Java\classes
           
1a.) Make sure the folder that you copy the WaterMark.class file into is located in the ClassPath in the ColdFusion Administrator.
           
2.) Go to ColdFusion Administrator in your web browser, then click on CFX Tags (under Extensions)

3.) Click Register Java CFX

4.) For Tag Name, type: CFX_WATERMARK      For Class Name, type: WaterMark

5.) Submit Changes




Documentation

Return String
CFX_WaterMark sets the WaterMarkMessage variable once it is complete.  WaterMarkMessage will contain the string "OK" when successful, or an error message.

Syntax

<CFX_WaterMark
        INPUTFILE = "text"
        OUTPUTFILE = "text"
        ALPHA = "integer"
        WATERMARKIMAGE = "text"
        IMAGEROTATION = "integer"
        IMAGEHORIZONTALPOS = "integer"
        IMAGEVERTICALPOS = "integer"
        FILLIMAGE = "boolean"
        WATERMARKTEXT = "text"
        FONTFACE = "text"
        FONTSTYLE = "text"
        FONTSIZE = "integer"
        FONTCOLOR = "hex"
        TEXTROTATION = "integer"
        TEXTHORIZONTALPOS = "integer"
        TEXTVERTICALPOS = "integer"
        FILLTEXT = "boolean"
        FILLHORIZONTALPADDING = "integer"
        FILLVERTICALPADDING = "integer">
       
Attributes

INPUTFILE
Required. The absolute path to the image you want to apply the watermark to.
Valid File Types: gif / jpeg images
Unix Example:    INPUTFILE = "\var\www\mysite\images\myimage.jpg"
Windows Example: INPUTFILE = "C:\inetpub\www\mysite\images\myimage.jpg"

OUTPUTFILE
Required. The absolute path to the watermarked image that is output by cfx_WaterMark.
Valid File Types: gif / jpeg images
Unix Example:    INPUTFILE = "\var\www\mysite\images\myimage-protected.jpg"
Windows Example: INPUTFILE = "C:\inetpub\www\mysite\images\myimage-protected.jpg"

ALPHA [Default = 30]
Optional. Alpha specifies the degree of transparency of the watermark. 
An Alpha of 1 specifies a completely transparent (not visible) watermark. An alpha of 100 specifies a fully opaque watermark.
Valid entries: integers between 1 - 100. 
Example: ALPHA = "45"

WATERMARKTEXT [Default = empty string]
Optional. The text used to watermark your image. You may combine text and image watermarks on the same image.
To break the text into multiple lines, use the pipe character '|' (located above the backslash on the keyboard) as seen in the example below.
Example: WATERMARKTEXT = "Copyright 2006 MyCompany, Inc."
Example: WATERMARKTEXT = "This is line 1|This is line 2"

FONTFACE [Default = Arial]
Optional. The font face associated with the WATERMARKTEXT.
Note: The availability of font faces will vary depending on your server.  Common fonts are Arial, Courier, Times New Roman and Verdana.
Example: FONTFACE = "Times New Roman"

FONTSTYLE [Default = Plain]
Optional. The font style associate with the WATERMARKTEXT.
Valid Entries: Plain, Italic, Bold
Example: FONTSTYLE = "Italic"

FONTSIZE [Default = 14]
Optional. The font size associated with the WATERMARKTEXT.
Example: FONTSIZE = "32"

FONTCOLOR [Default = 888888 (medium grey)]
Optional. The hexadecimal equivalent of the RGB color associated with the WATERMARKTEXT.  If you are unfamiliar with
hexadecimal colors, http://www.december.com/html/spec/color.html offers help choosing the right hex value.
Example: FONTCOLOR = "FF0000"

TEXTROTATION [Default = 0 degrees]
Optional. The rotation (in degrees) associated with the WATERMARKTEXT.
Valid Entries: -180 - 180
Example: TEXTROTATION = "45"

TEXTHORIZONTALPOS [Default = center]
Optional. The horizontal(x) position (in pixels) of the WATERMARKTEXT on the INPUTIMAGE.
Valid Entries: Left, Center, Right, Pixel Value
Example: TEXTHORIZONTALPOS = "Right"
Example: TEXTHORIZONTALPOS = "30"

TEXTVERTICALPOS [Default = center]
Optional. The vertical(y) position (in pixels) of the WATERMARKTEXT on the INPUTIMAGE.
Valid Entries: Top, Center, Bottom, Pixel Value
Example: TEXTVERTICALPOS = "Top"
Example: TEXTVERTICALPOS = "30"

FILLTEXT [Default = No]
Optional. This attribute determines whether or not to repeat the WATERMARKTEXT throughout the image.
The spacing between each WATERMARKTEXT is determined by FILLHORIZONTALPADDING and FILLVERTICALPADDING.
Valid Entries: Yes, No
Example: FILLTEXT = "Yes"

FILLHORIZONTALPADDING [Default = 20 pixels]
Optional. The amount of horizontal padding (in pixels) between each repeated WATERMARK.
Example: FILLHORIZONTALPADDING = 40

FILLVERTICALPADDING [Default = 20 pixels]
Optional. The amount of vertical padding (in pixels) between each repeated WATERMARK.
Example: FILLVERTICALPADDING = 40

WATERMARKIMAGE
Optional. The absolute path to an image used as the watermark.  You may combine image and text watermarks on the same image.
Valid File Types: gif / jpeg images
Unix Example:    WATERMARKIMAGE = "\var\www\mysite\images\watermark.gif"
Windows Example: WATERMARKIMAGE = "C:\inetpub\www\mysite\images\watermark.gif"

IMAGEROTATION [Default = 0 degrees]
Optional. The rotation (in degrees) associated with the WATERMARKIMAGE.
Valid Entries: -180 - 180
Example: IMAGEROTATION = "60"

IMAGEHORIZONTALPOS [Default = center]
Optional. The horizontal(x) position (in pixels) of the WATERMARKIMAGE on the INPUTIMAGE.
Valid Entries: Left, Center, Right, Pixel Value
Example: IMAGEHORIZONTALPOS = "Left"
Example: IMAGEHORIZONTALPOS = "50"

IMAGEVERTICALPOS [Default = center]
Optional. The vertical(y) position (in pixels) of the WATERMARKIMAGE on the INPUTIMAGE.
Valid Entries: Top, Center, Bottom, Pixel Value
Example: IMAGEVERTICALPOS = "Bottom"
Example: IMAGEVERTICALPOS = "40"

FILLIMAGE [Default = No]
Optional. This attribute determines whether or not to repeat the WATERMARKIMAGE throughout the image.
The spacing between each WATERMARKIMAGE is determined by FILLHORIZONTALPADDING and FILLVERTICALPADDING.
Valid Entries: Yes, No
Example: FILLIMAGE = "Yes"

Purchase here.

Need assistance with your project? Universal Web Services can help.
Contact us to request a quote.