Friday 03 Sep 2010   
Add Comment

Resizing images on the fly.

ColdFusion Tutorial #36

Resizing images on the fly with Coldfusion is easy. While it does put a strain on your server you may have a valid reason for wanting to do this.

demo.cfm

I have 3 images 1-3.jpg
Line 3 read the image into memory.
Line 5 write the image at the current size to the browser.
Line 8 resize the image in memory.
At this stage you could write the image back to a file or attach it to an email via cfmail etc.
Line 10 write the small image to the browser.



Demo

See this code running!


Download

Download this code as a zip!


Comments

I have implemted this alright, but I am having issues with certain files saved from photoshop, ColdFusion cant find the image for osme reason.. when I export it with Firewoks (same path and everything) the upload and resize works fine
Raul Riera @ Wednesday 27 May 2009 - 03:47:48 AM

Occasionally I find some images wont load correctly with CFIMAGE. I have sen't you my email address and you can forward on the exact files and I can take a look.
Paul Kukiel @ Wednesday 27 May 2009 - 04:17:24 AM

Click button to add a comment


Author

Paul Kukiel


Published

Tuesday 26 May 2009

Original

This tutorial has been modified and published with permission of the author. The original tutorial can be found here
http://blog.kukiel.net/2009/03/coldfusion-on-fly-image-resize.html 

Tags

cfimage  cfloop