This content has been marked as final. Show 5 replies
currently available cf versions do not have built-in image manipulation
support. you can do it, but you need to either use external tools or go
into Java classes. the upcoming CF8 will have a <cfimage> tag that will
allow image manipulation.
since your site is built with php, i suggest you search for available
php solutions - there are plenty out there, many free.
I use imageMagick ( http://www.imagemagick.org) for creating thumbnails and resizing images. It's free and can handle a fair amount of image formats
for example, to resize an image I would do the following,
first, create a .bat file, createResized.bat:
convert.exe %1 -resize 800x800 %2
then, in your code
<cfset string1 = '/C C:\whatever\createResized.bat "#vNewFileName#" "#vNewFileNameResized#"'>
<cfexecute name="cmd" arguments="#string1#" timeout="180"></cfexecute>
this is how I would resize something to not be greater than 800 pixels in any direction for example
I can't remember why I use .bat files instead of just calling the executable directly. It was a long time ago that I wrote this and I remember I ran into some kind of trouble, but perhaps that was just due to inexperience at the time.
ImageMagick is a better solution for a PHP site - it is the image utility used by mediawiki (the backend software of wikipedia) and countless other PHP packages. It seems pointless to point a PHP page to a coldfusion site just for image resizing.
If you have a coldfusion site, and imageCFC supports the formats and features you want, then it probably is the best option in terms of integrating neatly into your code.
If the feature set / format support of imageCFC is not sufficient for what you're doing (as it wasn't for me), then calling ImageMagick from Coldfusion can also be achieved relatively easy, and it is a very mature and feature rich set of tools.
Just to be clear, ImageMagick doesn't require installation / DLLs. - the executable files just need to be somewhere the Coldfusion server can do a CFEXECUTE on them and it has support under linux as well.