Home Tutorials/How to Links Blog Photos

Using cfimage to create thumbnails

I have been playing around with the new cfimage tag in coldfusion 8. I am very impressed with the resize capability. Coldfusion 8 seemed to do a great job resizing my images into thumbnails. I created a tutorial here.

Here is a little bit of code to create thumbnails.

<cfimage action="info" structname="imagetemp" source="Path to your image">
<cfset x=min(150/imagetemp.width, 113/imagetemp.height)>
<cfset newwidth = x*imagetemp.width>
<cfset newheight = x*imagetemp.height>
<cfimage action="resize" source="#Path to your image#" width="#newwidth#" height="#newheight#" destination="#thumbnail destination#">

Update: My Using CFIMAGE to Generate Thumbnails tutorial was published at learncf.com

Comments
Michael Evangelista's Gravatar Hi Damon -
I just started playing with this, too, and I am both impressed (at quality and speed) and relieved (at no longer jumping through extraneous hoops for images!).

I put up a little upload-resizer demo here
http://mredesign.com/demos/cfimage-example/
(no tutorial, though)
# Posted By Michael Evangelista | 11/18/07 9:01 PM
Dan G. Switzer, II's Gravatar @Damon:

You might want to look into the imageScaleToFit() function. The "resize" option doesn't keep proportion, where the imageScaleToFit() function does.
# Posted By Dan G. Switzer, II | 11/19/07 3:38 PM