hi guys i have a flex upload component and i would like the image to be resized when its uploaded but nothing happens. here is my upload.cfm file the flex component calls.
"upload.cfm" <!--- Flex Multi-File Upload Server Side File Handler This file is where the upload action from the Flex Multi-File Upload UI points. This is the handler the server side half of the upload process. ---> <!--- set the full path to the images folder ---> <cfset mediapath = expandpath('/realestate portal/images/agent_pics')> <!--- set the desired image height ----> <cfset thumbsize = 320> <!--- set the desired image width ---> <cfset imagesize = 192> <cftry> <!--- Because flash uploads all files with a binary mime type ("application/ocet-stream") we cannot set cffile to accept specfic mime types. The workaround is to check the file type after it arrives on the server and if it is non desireable delete it. ---> <cffile action="upload" filefield="filedata" <!--- destination="#ExpandPath('\')#realestate portal\images\agent_pics\" ---> destination="#MediaPath#" nameconflict="makeunique" accept="application/octet-stream"/> <!--- Begin checking the file extension of uploaded files ---> <cfset acceptedFileExtensions = "jpg,jpeg,gif,png,pdf,flv,txt,doc,rtf"/> <cfset filecheck = listFindNoCase(acceptedFileExtensions,File.ServerFileExt)/> <!--- read the image ----> <cfimage name="uploadedImage" source="#MediaPath#/#file.serverFile#" > <!--- figure out which way to scale the image ---> <cfif uploadedImage.width gt uploadedImage.height> <cfset thmb_percentage = (thumbsize / uploadedImage.width)> <cfset percentage = (imagesize / uploadedImage.width)> <cfelse> <cfset thmb_percentage = (thumbsize / uploadedImage.height)> <cfset percentage = (imagesize / uploadedImage.height)> </cfif> <!--- calculate the new thumbnail and image height/width ---> <cfset thumbWidth = round(uploadedImage.width * thmb_percentage)> <cfset thumbHeight = round(uploadedImage.height * thmb_percentage)> <cfset newWidth = round(uploadedImage.width * percentage)> <cfset newHeight = round(uploadedImage.height * percentage)> <!--- see if we need to resize the image, maybe it is already smaller than our desired size ---> <cfif uploadedImage.width gt imagesize> <cfimage action="resize" height="#newHeight#" width="#newWidth#" source="#uploadedImage#" destination="#MediaPath#/#file.serverFile#" overwrite="true"/> </cfif> <!--- create a thumbnail for the image ---> <cfimage action="resize" height="#thumbHeight#" width="#thumbWidth#" source="#uploadedImage#" destination="#MediaPath#/thumbs/#file.serverFile#" overwrite="true"/> <!--- If the variable filecheck equals false delete the uploaded file immediatley as it does not match the desired file types ---> <cfif filecheck eq false> <cffile action="delete" file="#MediaPath#/#file.serverFile#"/> </cfif> <!--- Should any error occur output a pdf with all the details. It is difficult to debug an error from this file because no debug information is diplayed on page as its called from within the Flash UI. If your files are not uploading check to see if an errordebug.pdf has been generated. ---> <cfcatch type="any"> <cfdocument format="PDF" overwrite="yes" filename="errordebug.pdf"> <cfdump var="#cfcatch#"/> </cfdocument> </cfcatch> </cftry> please advise