Adobe COLDFUSION 9 Manual page 973

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Working with Documents, Charts, and Reports
<!--- Create a ColdFusion image from a JPEG file. --->
<cfset myImage=ImageNew("../cfdocs/images/artgallery/jeff01.jpg")>
<!--- Add a 5-pixel blue border around the outside edge of the image. --->
<cfset ImageAddBorder(myImage,5,"blue")>
<!--- Add a 10-pixel magenta border around the blue border. --->
<cfset ImageAddBorder(myImage,10,"magenta")>
<!--- Add a 5-pixel green border around the magenta border. --->
<cfset ImageAddBorder(myImage,20,"green")>
<!--- Write the ColdFusion image to a file. --->
<cfset ImageWrite(myImage,"testMyImage.jpg")>
<img src="testMyImage.jpg"/>
Also, with the
ImageAddBorder
parameter to create a tiled border from the source image. The
wrap
the specified number of pixels to each side of the image, as though the image were tiled.
In the following example, 20 pixels from the outside edge of the source image are tiled to create the border:
<cfset myImage=ImageNew("../cfdocs/images/artgallery/jeff03.jpg")>
<cfset ImageAddBorder(myImage,20,"","wrap")>
<cfset ImageWrite(myImage,"testMyImage.jpg")>
<img src="testMyImage.jpg"/>
For examples of other border types, see the ImageAddBorder function in the CFML Reference.
Creating text images
You can create two types of text images:
• A CAPTCHA image, in which ColdFusion randomly distorts the text
• A text image, in which you control the text attributes
Creating a CAPTCHA image
You use the
action of the
captcha
readable. When you create a CAPTCHA image, you specify the text that is displayed in the CAPTCHA image;
ColdFusion randomly distorts the text. You can specify the height and width of the text area, which affects the spacing
between letters, the font size, the fonts to use for the CAPTCHA text, and the level of difficulty, which affects
readability. Do not use spaces in the text string specified for the
of the CAPTCHA image.
The following example shows how to write a CAPTCHA image directly to the browser.
function, you can add a border that is an image effect. For example, you can use the
tag to create a distorted text image that is human-readable but not machine
cfimage
Last updated 8/5/2010
parameter creates a tiled border by adding
wrap
attribute: users cannot detect the spaces as part
text
968

Advertisement

Table of Contents
loading

Table of Contents