Here is some code that I use to do this. This will create upload a file to the current directory, create a thumbnail (360 Height or 270 Width), copy the thumbnail to a graphics subdirectory and delete the original . The thumbnail is named "filename_thumb"
<cfif isdefined("Form.NewFile")> <cfset CurrentDir=GetDirectoryFromPath(ExpandPath("*.*"))> <cffile action="Upload" filefield="NewFile" destination="#CurrentDir#" nameconflict="Overwrite"> <cffile action="Copy" source="#CurrentDir#\#File.ServerFile#" destination="#CurrentDir#\graphics\"> <!--- Create a temporary copy of original image ---> <CFX_IMAGE ACTION="IML" NAME="IMAGES" FILE="#File.ServerDirectory#\#File.ServerFile#" COMMANDS=" getsize write TEMPFILE "> <!--- Resize and copy the image ---> <cfif #IMG_WIDTH# GT #IMG_HEIGHT#> <CFX_IMAGE ACTION="IML" NAME="IMAGES" FILE="#File.ServerDirectory#\#File.ServerFile#" COMMANDS=" resize 360 write #CurrentDir#\graphics\#File.ServerFileName#_thumb.#File.ServerFileExt# "> <cfelse> <CFX_IMAGE ACTION="IML" NAME="IMAGES" FILE="#File.ServerDirectory#\#File.ServerFile#" COMMANDS=" resize -1, 270 write #CurrentDir#\graphics\#File.ServerFileName#_thumb.#File.ServerFileExt# write #CurrentDir#\id\graphics\#File.ServerFileName#_thumb.#File.ServerFileExt# "> </cfif> <cfoutput >Thumbnail Size (#IMG_WIDTH#, #IMG_HEIGHT#)<br /> <!--- Preview the thumbnail image ---> <img src="graphics/#File.ServerFileName#_thumb.#File.ServerFileExt#" alt=""><br /> Please refresh your browser window to see the graphic.<br /> </cfoutput><br /> <!--- Delete the uploaded image ---> <cffile action="Delete" file="#CurrentDir#\#File.ServerFile#"> <cfelse> <!--- Show the upload form ---> <form action="upload4.cfm" method="post" enctype="multipart/form-data"> Please Choose a File to Upload <br> <input type="File" name="NewFile" size=40> <br> <input type="submit"> <input type="hidden" name="id" value="<cfoutput>#id#</cfoutput>"> </form> </cfif> -----Original Message----- From: Mark Smeets [mailto:msmeets@;prowerks.com] Sent: Friday, November 01, 2002 9:27 PM To: CF-Talk Subject: CFX_Image Help-Resizing Doesn't work Hi all, I'm trying to use the tag to resize pictures I'm uploading. The upload works great, it'll copy the pictures into their respective files names however they won't be resized. Any ideas why? (restarted the server, the machine etc...running cf 5) -------------------------------------- Mark Smeets / stranger0 / ICQ: 1062196 [EMAIL PROTECTED] http://www.prowerks.com/stranger "Life is a series of small victories" - Gene Simmons ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm