Hi guys,
I'm hoping someone can help me. I have a problem where when I upload a file i need to also resize it. I have the upload sorted and have a way of renaming it, after these it enters the name into the db. I am trying to use imagecfc from
When I test the code it uploads, and renames ok and also sends the name to the db. but does not adjust the size. The strange thing is the code to resize is also the code to rename and it renames it fine.
My code is this:
<!--- Upload Pic --->
<CFSET today = DateFormat(Now(),"DDMMYY")>
<CFSET now = TimeFormat(Now(),"HHmmss")>
<cfif isdefined("form.submit_upload")>
<cfif isdefined("FORM.filename1") AND #FORM.filename1# NEQ "">
<cffile action="UPLOAD" filefield="filename1" destination="DIRPATH\db_images\" nameconflict="MAKEUNIQUE">
<CFSET img1= AgentLOGIN& #today# & #now#>
<CFSET img=ListAppend(img1,FILE.ServerFileExt,".")>
<cfset imageCFC = createObject("component","image")>
<cfset imgInfo = imageCFC.scaleWidth("", "*DIRPATH*\db_images\#CFFILE.ServerFile#", "*DIRPATH*\db_images\#img#", 100, 60)>
<cfset form.filename1="#img#">
<cfelse>
''
</cfif>
</cfif>
I have the cfc files in I dunno if that makes a difference. I was told that it did not matter where they are placed under folder.
I struggling to figure out why this is not working. I have tryed a few different ways to write the code using a few different tutorials and they have all made the same results which means the error is me lol. Any help or guidance will be appreciated.
Thanks
Rob
I'm hoping someone can help me. I have a problem where when I upload a file i need to also resize it. I have the upload sorted and have a way of renaming it, after these it enters the name into the db. I am trying to use imagecfc from
When I test the code it uploads, and renames ok and also sends the name to the db. but does not adjust the size. The strange thing is the code to resize is also the code to rename and it renames it fine.
My code is this:
<!--- Upload Pic --->
<CFSET today = DateFormat(Now(),"DDMMYY")>
<CFSET now = TimeFormat(Now(),"HHmmss")>
<cfif isdefined("form.submit_upload")>
<cfif isdefined("FORM.filename1") AND #FORM.filename1# NEQ "">
<cffile action="UPLOAD" filefield="filename1" destination="DIRPATH\db_images\" nameconflict="MAKEUNIQUE">
<CFSET img1= AgentLOGIN& #today# & #now#>
<CFSET img=ListAppend(img1,FILE.ServerFileExt,".")>
<cfset imageCFC = createObject("component","image")>
<cfset imgInfo = imageCFC.scaleWidth("", "*DIRPATH*\db_images\#CFFILE.ServerFile#", "*DIRPATH*\db_images\#img#", 100, 60)>
<cfset form.filename1="#img#">
<cfelse>
''
</cfif>
</cfif>
I have the cfc files in I dunno if that makes a difference. I was told that it did not matter where they are placed under folder.
I struggling to figure out why this is not working. I have tryed a few different ways to write the code using a few different tutorials and they have all made the same results which means the error is me lol. Any help or guidance will be appreciated.
Thanks
Rob