"X resolution" error when using CFIMAGE
I've built an uploader for my new photo gallery, and it's pretty basic. I can either upload using the new <cffileupload> box, or I can FTP files to an "upload" directory. Since the entire site is local still, I've just been copying the files I want to add to the database to the "upload" directory, then running my script. So far I've created 49 albums and added just over 3,400 pics.
That is, until this latest round.
I have some pics I took on a cruise a couple of years ago. There are just fewer than 400 of them. When I copy the files to my upload folder, pick my album, then click "Submit", get the following errors from <cfcatch>:
cfcatch.type = Application
cfcatch.message = X Resolution
cfcatch.detail = X Resolution
That's ALL I get.
On the upload form, there's a <cfif> statement that copies the original images to a "/fullsize/" directory before processing if they're 1280px wide or less. Otherwise it resizes them using <cfimage>. In this case, the files are all 1280 wide, so the next <cfimage> tag is the one that makes the default viewing pic.
Here's the code I'm using:
<cfdirectory action="list" directory="#request.basepath#/manage/upload" name="uploads" sort="name ASC" mode="777">
<cfsetting requesttimeout="#createtimespan(0,1,0,0)#">
<cftry>
<cfloop query="uploads">
<!--- calculate portrait or landscape --->
<cfimage source="#request.basepath#/manage/upload/#uploads.name#" name="thisimage">
<cfif thisimage.height gt thisimage.width>
<cfset imgheight="800">
<cfset imgwidth="">
<cfset thumbheight="180">
<cfset thumbwidth="">
<cfelse>
<cfset imgheight="">
<cfset imgwidth="800">
<cfset thumbheight="">
<cfset thumbwidth="180">
</cfif>
<!--- add pics to database --->
<cfif IsNull(ImageGetEXIFTag(thisimage,"Date/Time Original"))>
<cfset pictimestamp = uploads.dateLastModified>
<cfelse>
<cfset pictimestamp = replace(listfirst(ImageGetEXIFTag(thisimage,"Date/Time Original")," "),":","-","ALL") & " " & listlast(ImageGetEXIFTag(thisimage,"Date/Time Original")," ")>
</cfif>
<!--- create full size file --->
<cfif thisimage.width gt 1280>
<cfimage
action="resize"
width="1280"
height=""
source="#request.basepath#/manage/upload/#uploads.name#"
destination="#request.basepath#/gallery/fullsize/#uploads.name#">
<cfelse>
<cffile
action="copy"
source="#request.basepath#/manage/upload/#uploads.name#"
destination="#request.basepath#/gallery/fullsize/#uploads.name#"
mode="777">
</cfif>
<!--- create main photo --->
<cfimage
action="resize"
width="#imgwidth#"
height="#imgheight#"
source="#request.basepath#/manage/upload/#uploads.name#"
destination="#request.basepath#/gallery/#uploads.name#">
<!--- create thumbnail --->
<cfimage
action="resize"
width="#thumbwidth#"
height="#thumbheight#"
source="#request.basepath#/manage/upload/#uploads.name#"
destination="#request.basepath#/gallery/thumbnails/#uploads.name#">
<cfquery name="addpicstodb" datasource="#request.dsn#" timeout="#createtimespan(0,1,0,0)#">
INSERT INTO photos
( pic_album
, pic_file
, pic_date
)
VALUES ( <cfqueryparam value="#FORM.upload_album#" cfsqltype="cf_sql_numeric">
, <cfqueryparam value="#uploads.name#" cfsqltype="cf_sql_varchar">
, <cfqueryparam value="#pictimestamp#" cfsqltype="cf_sql_timestamp">
)
</cfquery>
<!--- clean upload directory --->
<cffile
action="delete"
file="#request.basepath#/manage/upload/#uploads.name#">
</cfloop>
<cfcatch type="any">
<cfoutput>#cfcatch.type# - #cfcatch.message# - #cfcatch.detail# - #cfcatch.ExtendedInfo#</cfoutput>
</cfcatch>
</cftry>
Keep in mind this has worked for over 3,400 pics, so something perhaps is different about this set of pics I'm uploading.
The pics are all around 600KB in size (jpegs), and are 1280x853px in resolution. I've even batch-renamed them with a unique file prefix to avoid naming conflicts.
