
960
DEVELOPING
COLDFUSION 9 APPLICATIONS
Working with Documents, Charts, and Reports
Las
t
upda
te
d 8/5/2010
The ColdFusion image
A ColdFusion
image
is a construct that is native to ColdFusion. The ColdFusion image contains image data that it
reads from a source. The source can be an image file or another ColdFusion image, which is expressed as a ColdFusion
image variable. The ColdFusion image variable lets you manipulate information dynamically in memory. Optionally,
you can write a ColdFusion image to a file, to a database column, or to a browser.
The cfimage tag
You use the
cfimage
tag to create a ColdFusion image and as a shortcut to commonly performed image functions,
such as resizing an image, adding a border to an image, and converting an image to a different file format. You can use
the
cfimage
tag independently or in conjunction with
Image
functions. You can pass a ColdFusion image created with
the
cfimage
tag to one or more
Image
functions to perform complex image manipulation operations.
The following table summarizes the
cfimage
tag actions:
For more information, see the cfimage tag in the
CFML Reference
.
Enforce compression on JPEG images
quality
attribute of the
write
action of the
cfimage
tag or the
ImageWrite
function
Convert an image from one image file format to another (for
example, convert a BMP file to a JPEG)
cfimage
tag or
ImageRead
and
ImageWrite
functions
Convert an image file to a Base64 string
cfimage
tag or the
ImageWriteBase64
function
Create a ColdFusion image from a Base64 string
ImageReadBase64
function
Insert a ColdFusion image as a Binary Large Object Bitmap
(BLOB) in a database
ImageGetBlob
function within a
cfquery
statement
Create an image from a BLOB in a database
cfimage
tag or the
ImageNew
function with a
cfquery
statement
Create an image from a binary object
cffile
tag to convert an image file to a binary object and then pass the
binary object to the
ImageNew
function
Create a Completely Automated Public Turing test to tell
Computers and Humans Apart (CAPTCHA) image
captcha
action of the
cfimage
tag
Action
Description
border
Creates a rectangular border around the outer edge of an image.
captcha
Creates a CAPTCHA image.
convert
Converts an image from one file format to another.
info
Creates a ColdFusion structure that contains information about the image, including the color model, height, width,
and source of the image.
read
Reads an image from the specified local file path or URL. If you do not specify an action explicitly, ColdFusion uses
read
as the default value.
resize
Resizes the height and width of an image.
rotate
Rotates an image by degrees.
write
Writes the image to a file. You can use the
write
action to generate lower-resolution JPEG files. Also, use the
write
action to convert images to other file formats, such as PNG and GIF.
writeToBrowser
Writes one or more images directly to a browser. Use this action to test the appearance of a single image or write
multiple images to the browser without saving the images to files.
Task
Functions and actions