House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

cfimage in loop kills loop and throws error

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Tony Bentley
01/08/2009 07:44 PM

I am having problems with cfimage when it comes to large images. Say 1mb each and over 50 images. I upload the images in a zipped folder, unzip them, run a loop to resize the original 4 times (original, medium, thumb and mini thumb). I know that it all works as long as the images are small enough in file size and the quantity is less than 50. So again, if the zipped folder is 500kb x 50 images or less it works. I want to be able to upload 1.5mb sized images and up to 100 (or no limit ideally). The page request is unlimited so what could be causing it? I tried using cfthread for each request but only about half would run and the rest would update the database but not run resizing functions.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Adrian Lynch
01/08/2009 08:11 PM

Show us your code. It could be that you're running out of memory. What error are you getting? Adrian Building a database of ColdFusion errors at http://cferror.org/ ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Tony Bentley
01/08/2009 08:27 PM

<cfloop query="whatever">                 <cfimage                 source="#large#\#imgname#"                 name="objImage" action="read" />                                  <cffile action="delete" file="#large#\#imgname#" >                            <!--- get the image filename --->                              <cfquery name="getimgs" datasource="#client.datasource#">                 select title from gallery where imgid = '#id#'                 </cfquery>                                   <cfquery name="update_large" datasource="#client.datasource#">                     UPDATE                     gallery                     SET                     image = '#imgname#'                     where imgid = '#id#'                  </cfquery>                                                                            <cfif objImage.width gt 1200>                         <cfset ImageScaleToFit(objImage,1200,1200,"highestPerformance")>                                                      <cfimage overwrite="yes"                         action="write"                         source="#objImage#"                         destination="#large#\#imgname#" format="jpg" />                                             <cfelse>                                            <cfimage overwrite="yes"                         action="write"                         source="#objImage#"                         destination="#LargeDir#\#imgname#"  format="jpg"  />                                                                       </cfif>                                      </cfif>                       <cfif isImage(objImage)>                                       <cfif objImage.width gt 700>                                          <cfset ImageScaleToFit(objImage,700,700,"highestPerformance")>                                      </cfif>                                                                                 <cfimage overwrite="yes"                 action="write"                 source="#objImage#"                 destination="#LargeDir##id#.jpg"  format="jpg" />                                       <cfset ImageScaleToFit(objImage,150,150,"highestPerformance")>                                             <cfimage overwrite="yes"                 action="write"                 source="#objImage#"                 destination="#ThumbDir##id#.jpg"  format="jpg" />                          <!--- scale to flash size --->                 <cfset ImageScaleToFit(objImage,75,75,"highestPerformance")>                                <!--- crop to center --->                 <cfif objImage.width gt objImage.height>                                      <cfset imageCrop(objImage,12.5,0,50,50)>                      <cfelse>                                      <cfset imageCrop(objImage,0,12.5,50,50)>                                  </cfif>                                  <cfimage overwrite="yes"                 action="write"                 source="#objImage#"                 destination="#FlashDir##id#.jpg"  format="jpg" /> </cfloop>     

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Tony Bentley
01/08/2009 08:33 PM

ERROR: The request has exceeded the allowable time limit Tag: CFLOOP

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Matt Quackenbush
01/08/2009 08:48 PM

That error means exactly what it says: your cfloop is running for longer than is allowable. Try adding a requesttimeout setting and playing with the length. <cfsetting requesttimeout="{number of seconds" /> On Thu, Jan 8, 2009 at 7:22 PM, Tony Bentley wrote: > ERROR: The request has exceeded the allowable time limit Tag: CFLOOP >

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Adrian Lynch
01/08/2009 08:54 PM

Add this to the top of the page to get CF to wait longer: <cfsetting requesttimeout="999999"> Adrian > ERROR: The request has exceeded the allowable time limit Tag: CFLOOP

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Tony Bentley
01/09/2009 01:50 PM

That took care of it. Thanks folks.


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

March 21, 2010

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
   1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31