Ever needed to resize images on the fly? Its easy with ColdFusion and cfimage.
I have 3 images 1-3.jpg in a directory Read the image into memory. Write the image at the current size to the browser. 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. Write the small image to the browser.
<cfloop from= "1" to= "3" index= "i"> <!--- Read in the file ---> <cfimage action= "read" source= "#expandPath('.')#\#i#.jpg" name= "tempPicture" /> <!--- output the original image ---> <cfimage action= "writetobrowser" source= "#tempPicture#" /> <!--- resize the image ---> <cfimage action= "resize" width= "30%" height= "30%" source= "#tempPicture#" name= "smallPicture" /> <!--- write small image to browser ---> <cfimage action= "writetobrowser" source= "#smallPicture#"/> </cfloop>
Yes thats all thats required.
+