Table Of Contents
 

ProFlash Upload - Processing Uploads: Image File Resizing Example

In this example we will use ProFlashUpload to upload images to the server and then use a custom include file to perform image resizing on each image after it has been uploaded. In this example, I'm using Rick Roots excellent imageCFC to perform the custom uploading.

Step 1


To start with, use the filter option to specify that we only want image files. Also pass the name of your include file:
<cf_dccom component="ProFlashUpload" includeOnUpload="inc_resizeImages.cfm" filter="All Images,*.jpg;*.jpeg;*.png;*.gif,All Files,*.*"
folder="yourUploadFolderHere"
></cf_dccom>
The inc_resizeImages.cfm should be in the root of your application.

Step 2


Create the inc_resizeImages.cfm file and copy in the following:
<cfset uploadedImageFullFilePath = ATTRIBUTES.folder & File.ServerFile>
<cfset imageCFC = createObject("component","image")>
<cfset imgInfo = imageCFC.resize("", uploadedImageFullFilePath, uploadedImageFullFilePath,200,200)>

Tips


Include File Location


You could pass includeOnUpload="includes/inc_resizeImage.cfm" and the custom processing file would then have to be at "[appRoot]/includes/inc_resizeImages.cfm".