ColdFusion 9.0 Resources |
Writing images to the browserUse the writeToBrowser action of the cfimage tag to display images directly in the browser without writing them to files. This technique is useful for testing the appearance of a ColdFusion image. The following example shows how to test the display of two effects applied to an image: <cfset myImage=ImageNew("../cfdocs/images/artgallery/paul01.jpg")> <cfset ImageBlur(myImage,5)> <cfset ImageNegative(myImage)> <cfimage source="#myImage#" action="writeToBrowser"> The writeToBrowser action displays images in PNG format. Also, you can write multiple images to the browser which is useful if you want to manipulate images in memory and display them without writing them to files. For example, you can duplicate several versions of the same image, display the versions in a browser, and allow the user to choose one of the images to write to a file. Or, you can extract images from a database, add a watermark to the images that appear in the browser, such as Proof or Draft, without having to write the modified images to files first. This way you can maintain one set of image files and change them on-the-fly. For an example of writing multiple images to the browser, see Generating a gallery of watermarked images. |