Skip to main content
Participant
March 16, 2009
Question

problem with ImageResize & cfimage

  • March 16, 2009
  • 2 replies
  • 566 views
I have some code to resize the images in loop

<cfloop index="i" from="1" to="#ArrayLen(fr)#" step="1">
<cfset myImage=ImageNew("#Application.site#/img/albums/temp/#fr ['to']#")>
<cfset info=ImageInfo(myImage)>
<cfset ImageResize(myImage,"50","")>
<cfimage source="#myImage#" action="write" destination="#Application.site#/img/albums/1/a.#aid#/#fr
['to']#" overwrite="yes">
</cfloop>

when the images more then 1mb Loop return with timeout error (The request has exceeded the allowable time limit Tag: CFLOOP)
How i can run cfimage and imageresize in background mode? Or any other way to solve this problem?
This topic has been closed for replies.

2 replies

Participating Frequently
March 17, 2009
Note that if the server has a set timeout (using SeeFusion or some other method) then even using CFThread won't get around this - you'll have to reduce the allowable size of your image to make sure processing time is less than the timeout or contact the remote host and ask for an exemption for that page...though it's unlikely they will grant it since the timeout exists for a reason (to ensure the server runs smoothly).
Inspiring
March 17, 2009
> How i can run cfimage and imageresize in background mode? Or any other way to
> solve this problem?

Read up on <cfthread>

http://livedocs.adobe.com/coldfusion/8/Tags_t_04.html

--
Adam
Participant
March 17, 2009
I try to use cfthread, but resizing is not working.
Where my error?

<cfloop index="i" from="1" to="#ArrayLen(fr)#" step="1">
<cfthread action="run" name="#i#">
<cfset myImage=ImageNew("#Application.site#/img/albums/temp/#fr ['to']#")>
<cfset info=ImageInfo(myImage)>
<cfif info.width gt "50">
<cfset ImageResize(myImage,"50","")>
</cfif>
<cfimage source="#myImage#" action="write" destination="#Application.site#/img/albums/1/a.#aid#/#fr
['to']#" overwrite="yes">
</cfthread>
</loop>