Writes a java BufferedImage object to the file system.
A structure containing the following fields:
| key | value |
|---|---|
| errorCode | 0 for success, non-zero for failure. Always returned, but not really used if the throwOnError option is set to true. |
| errorMessage | A description of the error. Always returned, but not really used if the throwOnError option is set to true. |
writeImage(outputFile, objImage, jpegCompression)
| Parameter | Required? | Default | Description |
|---|---|---|---|
| outputFile | YES | - | File path to write the output. |
| objImage | YES | - | A java image object. |
| jpegCompression | NO | defaultJpegCompression | jpeg compression quality to use if writing a jpeg file. 0-100. 100 is the highest quality. |
The following example reads an image from a url and saves it locally to disk using the readImage() and writeImage() methods.
<cfset imageCFC = createObject("component","image")>
<cfset img = imageCFC.readImage("http://www.somedomain.com/myimage.jpg")>
<cfset results = imageCFC.writeImage(img, "C:\Inetpub\wwwroot\myimage.jpg")>