Writes a ColdFusion image to the specified filename or destination.
Nothing.
ImageWrite(name
[,destination
,quality
])
cfimage, GetWriteableImageFormats, ImageNew, ImageRead, IsImageFile
ColdFusion 8: Added this function.
Parameter |
Description |
---|---|
name |
Required. The ColdFusion image on which this operation is performed. |
destination |
Optional. The absolute or relative pathname where you write the file. If you create the image with the ImageNew function or another operation where you do not specify the filename, you must specify the destination parameter. The file format is derived from the extension of the filename. The default value for this parameter is the filename of the original image source. |
quality |
Optional. Defines the JPEG quality used to encode the image. This parameter applies only to destination files with an extension of JPG or JPEG. Valid values are fractions that range from 0 through 1 (the lower the number, the lower the quality). The default value is 0.75. |
The file format is derived from the file extension, therefore, use this function to convert images.
For a list of valid formats to write, seeSupported image file formats. To retrieve a list of writable formats on the server where the ColdFusion application is deployed, use the GetWriteableImageFormats function.
<!--- This example shows how to convert a GIF image to a PNG image. ---> <!--- Use the ImageNew function to create a ColdFusion image. ---> <cfset myImage = ImageNew("http://www.google.com/images/logo_sm.gif")> <!--- Convert the image to a PNG format. ---> <cfset ImageWrite(myImage,"google.png")> <!--- Display the PNG image. ---> <img src="google.png">