timeout error

Results 1 to 2 of 2

Thread: timeout error

  1. #1
    Join Date
    Dec 1969

    Default timeout error

    I am trying to resize images in a folder into 2 different sizes and add a record for each image into a table. My script does this in 3 processes 1. add to database 2. create 550 pixel images 3. create 100 pixel images. The script gets half way through the third process and timesout. I tried changing the timeout to various settings but the error occurs each time.<BR><BR>Is there a way I can split each process to stop this happening?<BR><BR>If I test it on only a couple of images it works ok. It nearly does the job but timesout just before the end.<BR><BR>see below for the code I am using...<BR><BR>For each filefound in MyFiles.files<BR>If LCase(Right(filefound.Name, 1)) &#060;&#062; "g" Then <BR>filefound.delete<BR>Else<BR>addImages = ("INSERT INTO images2 (file_name, model_id, group_id, feature_id, folder, photographer, licencedOwner, location, strength, scene, style, subcat, product) values (&#039;" & filefound.name & "&#039;," & model & "," & group & "," & feature & ",&#039;" & folder & "&#039;," & photographer & "," & owner & "," & location & "," & strength & "," & scene & "," & style & "," & subcat & "," & product & ")")<BR>oConn.execute(addImages)<BR>end if<BR>Next<BR><BR>end if<BR>Set dImage = Server.CreateObject("dImage.dThumb")<BR>For each filefound in MyFiles.files<BR>dImage.GetImage "c:webcoolpiranhaimages\" & firstFolder &"\" & secondFolder &"\" & folder &"original\" & filefound.Name<BR>dImage.ResizeMax 550<BR>dImage.JPGQuality = 75<BR>dImage.SaveImage "c:webcoolpiranhaimages\" & firstFolder &"\" & secondFolder &"\" & folder &"gallery\" & filefound.Name<BR>Next<BR><BR>For each filefound in MyFiles.files<BR>dImage.GetImage "c:webcoolpiranhaimages\" & firstFolder &"\" & secondFolder &"\" & folder &"original\" & filefound.Name<BR>dImage.ResizeMax 100<BR>dImage.JPGQuality = 75<BR>dImage.SaveImage "c:webcoolpiranhaimages\" & firstFolder &"\" & secondFolder &"\" & folder &" humb\" & filefound.Name<BR>Next

  2. #2
    Join Date
    Dec 1969

    Default here is a way - brute force

    I had the same problem when I had to add thumbs to a folder of over 2000 images. I assume you have a similar task.<BR><BR>You can do the following:<BR><BR>STEP 1<BR>------<BR>Create a table of the images that are not resized. For example,<BR>with 3 fields (or add a boolean field to your existing table).<BR>UnresizedID - this is your autonumbered key field<BR>Imagename - this the name of the unresized image<BR>Resizecheck - this is a boolean switch that gets turned when the image is resized.<BR><BR>STEP 2<BR>------<BR>You will have one asp page. This page will contain (much like your page current:<BR><BR>- a SQL statement that will fetch the Unresized Images<BR>- a resizing routine<BR>- a record creation/updating routine<BR><BR>The SQL statement looks something like this:<BR><BR>query="SELECT imagename, resizecheck FROM tblImages WHERE resizecheck"<BR><BR>If there are no records then response.end.<BR><BR>Then you resize the image and save the resized images.<BR><BR>Then you update your original table, or use the new table to save your resized image name.<BR><BR>Then - VERY IMPORTANT - you change the boolean switch to TRUE in tblImages.<BR><BR>Then you call the page again. (response.redirect("mypage")).<BR><BR>You DO NOT loop through the recordset. The next time the page is called, the resized record will not be selected and the next record will utilized. By doing this you will eventually loop through all the records, they will all be resized and no recors will be retrieved. And no timeouts.<BR><BR>What happens is the every time you resize an image and switch the boolean switch, the recordset selected in the SQL statement shrinks by one record.<BR><BR>You get no timeout becaue the time-out is reset every time a new page is called.<BR><BR>Basically, you are looping on the server instead of on the page.<BR><BR>When the SQL statement retrieves no records, the script ends.<BR><BR>If you had a page counter on this page, it would be equal to the number of images resized.<BR><BR>This probably isn&#039;t very good programming, but it works. I call it the "brute force" method.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts