Add Comment
Simple introduction to CFIMAGE Tutorial
ColdFusion Tutorial #4
This is a simple introduction to the new CF image tags and some of the neat and easy features.
demo.cfm
The demonstration code performs 3 distinct manipulations to images.1. Writing text onto of an image.
2. Drawing one image over another.
3. Image resizing.
Lines 1-20 are simply setting up the form we won’t worry about that.
Line 22-24 is where you create a structure and assign values for the attributes for the text to be drawn on top of the image. See : http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=functions_h-im_21.html for details.
Line 26 simply read in a file. notice this is jpg cfimage supports a variety of image formats BMP, GIF, JFIF, JPEG, JPEG 2000, JPEG-LOSSLESS, JPEG-LS, JPEG2000, JPG, PNG, PNM, RAW, TIF, TIFF, WBMP.
Line 29 I write the text onto the image read in. ImageDrawtext take upto 5 arguments. The image to draw onto, the text, x and y coordinates and the optional text style attributes.
Line 30 read in a second image ( png this time ).
Line 31 Draw the first image on top of the original. ImagePaste take 4 arguments the bottom image, top image and x and y coordinates.
Line 32 resizes the image.
Line 33 writes the image back to the browser. You can also write out to a file.
Demo
See this code running!
Download
Download this code as a zip!
Comments
Nice start to your new web site. I would like to recommend you specialize in all CF8 tutorials. I have CF8 but with Ben and Ray's book not out yet, there are not many places to get CF8 examples.Dave Dugdale @ Friday 31 Aug 2007 - 11:40:40 PM
asdas
asd @ Saturday 26 Feb 2011 - 12:02:12 AM
good
ming @ Monday 10 Oct 2011 - 03:10:05 AM
Click button to add a comment
Author
Paul Kukiel