Creates a ColdFusion image. Note: You can specify this tag's attributes in an attributeCollection attribute whose value is a structure. Specify the structure name in the attributeCollection attribute and use the tag's attribute names as structure keys. Border color. Absolute or relative pathname where the image output is written. The image format is determined by the file extension.
|Published (Last):||11 April 2015|
|PDF File Size:||11.98 Mb|
|ePub File Size:||3.78 Mb|
|Price:||Free* [*Free Regsitration Required]|
Configuring and Administering Adobe ColdFusion 9. Developing Adobe ColdFusion 9 Applications. Using the cfimage tag. Using the ImageNew function. Creating an image from a binary object. Creating images from BLOB data. Creating an image from a Base64 string. Copying an image. Duplicating an image. The ColdFusion image contains image data in memory. Before you can manipulate images in ColdFusion, you create a ColdFusion image.
The following table shows the ways to create a ColdFusion image:. ImageReadBase64 function and the ImageNew function or the cfimage tag. ImageCopy function with the ImageWrite function or the Duplicate function, or by passing the image to the ImageNew function or the cfimage tag. The simplest way to create a ColdFusion image with the cfimage tag is to specify the source attribute, which is the image file that ColdFusion reads, and the name attribute, which is the variable that defines the image in memory:.
You do not have to specify the read action because it is the default action. Specify the name attribute for the read action, which creates a variable that contains the ColdFusion image, for example, myImage. You can pass the myImage variable to another cfimage tag or to Image functions.
The following example shows how to specify a ColdFusion image variable as the source:. The write action writes the file to the specified destination, which can be an absolute or relative path. The following example shows how to create a ColdFusion image from a URL and write it to a file on the local storage drive:.
When you specify a destination , set the overwrite attribute to " yes " to write to the same file more than once. Otherwise, ColdFusion generates an error:. As with the cfimage tag, you can specify an absolute or relative path, a URL, or another ColdFusion image as the source. In the following example, ColdFusion reads a file from the local drive and passes it to the ImageWrite function, which writes the image to a new file:. Also, you can create a blank image.
When using the ImageNew function, you do not specify the source to create a blank image. However, you can specify the width and height, respectively. The following example shows how to create a blank canvas that is pixels wide and pixels high:. Other valid image types are argb and grayscale. You can use blank images as canvasses for drawing functions in ColdFusion. For examples, see Creating watermarks.
You can use the cffile tag to write an image file to ColdFusion variable. Then, you can pass the variable to the ImageNew function to create a ColdFusion image from the binary object, as the following example shows:. Many databases store images as BLOB data.
To extract BLOB data from a database, create a query with the cfquery tag. You can use the cfimage tag or the ImageReadBase64 function to read Base64 data directly from a database.
Doing so eliminates the intermediary steps of binary encoding and decoding. The following examples show how to use the cfimage tag to create a ColdFusion image from a Base64 string:.
The following examples show how to use the ImageReadBase64 function to create a ColdFusion image from a Base64 string:. For more information on Base64 strings, see Converting an image to a Base64 string.
You use the ImageCopy function to copy a rectangular area of an existing image and generate a new ColdFusion image from it. You can paste the new ColdFusion image onto another image, or write it to a file, as the following example shows:. Another way to create a ColdFusion image is to duplicate it. Duplicating an image creates a clone , which is a copy of an image that is independent of it: if the original image changes, those changes do not affect the clone, and the reverse.
This technique is useful if you want to create several versions of the same image. Duplicating an image can improve processing time because you retrieve image data from a database or a file once to create the ColdFusion image. Then you can create several clones and manipulate them in memory before writing them to files.
For example, you could create a thumbnail version, a grayscale version, and an enlarged version of an image uploaded to a server. To do so, you use the cfimage tag or the ImageNew function to create a ColdFusion image from the uploaded file.
You use the Duplicate function to create three clones of the ColdFusion image. To create a clone, you can pass a ColdFusion image variable to the Duplicate function:.
Also, you can use the cfimage tag and the ImageNew function to duplicate images, as the following example shows:. View Help PDF adobe. ColdFusion 9. Creating ColdFusion images. The following table shows the ways to create a ColdFusion image: Task Functions and tags Create a ColdFusion image from an existing image file. ImageNew function with the cfquery tag Create a ColdFusion image from a binary object.
Creating an image from a binary object You can use the cffile tag to write an image file to ColdFusion variable. Copying an image You use the ImageCopy function to copy a rectangular area of an existing image and generate a new ColdFusion image from it. Duplicating an image Another way to create a ColdFusion image is to duplicate it. ImageNew function. ImageNew function with the cfquery tag. Create a ColdFusion image from a binary object.
Create a ColdFusion image from a Base64 string. Create a ColdFusion image from another ColdFusion image.
Using The Quality Attribute With The CFImage WriteToBrowser Action
Finally, ColdFusion 8 has incorporated image manipulation directly into the ColdFusion tag and scripting language. These products, while excellent in quality, just meant adding one more level of complexity to any application that required server-side image manipulation. Now, with CFImage and an abundance of image related functions, ColdFusion has done to image manipulation what it has done to most every other aspect of web applications development - it has made it simple. Due to the wide array of image functionality in ColdFusion 8, I am going to try and break this tutorial up into several small and management parts. The first part will cover basic reading and writing of images using CFImage and the related image manipulation functions. But, before we get into that, let's just quickly touch upon these new features as a whole.
Creates a ColdFusion image that can be manipulated by using image functions. You can use the cfimage tag to perform common image manipulation operations as a shortcut to Image functions. You can use the cfimage tag independently or in conjunction with image functions. Example of resizing an image stored in a variable and storing the result in a variable. The action to take. Hexadecimal value or supported named color. For a hexadecimal value, use the form " xxxxxx" or "xxxxxx".
Learning ColdFusion 8: CFImage Part I - Reading And Writing Images
Tags Functions Contact Login. The action to take. Hexadecimal value or supported named color. For a hexadecimal value, use the form " xxxxxx" or "xxxxxx". Can be either a full physical path or a relative path see the URIDirectory attribute.