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

7 Responses To  “Using cfimage to create thumbnails”
  • Michael Evangelista

    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)

  • Dan G. Switzer, II

    @Damon:

    You might want to look into the imageScaleToFit() function. The &#34;resize&#34; option doesn’t keep proportion, where the imageScaleToFit() function does.

  • Robin

    I really like what you put together on your demo. Do you have the code for download? This demo could come in handy! Thanks, Robin.

  • bob

    don't forget to round your new values

  • Stephen Gracey

    It's bogging down my site, I think–anyone else experiencing delays with more than a few images on a page??

  • cfperformance

    Yep the performance on concurrency would probably bog down your server . If I use a 1.3 MB jpg to resize.
    It takes about 13 seconds after the upload is complete to resize.

Leave A Reply