Jump to content

How to process images with limited time?


mikeym

Recommended Posts

OK. My providers are as it turns out Nazis and wont turn off safe mode so I am unable to run any piece of code for more than 30 seconds.  This makes my task of allowing my users to upload a number of images which I resize and put onto the page for displaying rather tricky.

 

I've been trying to think of ways to circumnavigate this issue. The first step I've taken it to copy the uploaded files into a temporary directory and finish so as to not run out of time.

 

What I was thinking was that I could direct them to a page that would process one image from the temp dir then call itself until the temp dir was empty. However I've found that any script calling itself causes an error.

 

This page cannot load because of a problem with the Web site.

The server “www.getoutofglasgow.com” is redirecting in a way that will never complete.

 

So the only other things I can think off are setting a refresh time of 30 seconds on the page (which will waist a lot of time as it will wait for 30 secs even if the script finishes before hand) or making a series of confirmation pages that will post a resonce from the user to confirm the images one at a time (pretty much what I was wanting to avoid).

 

This is also assuming that the post is allowed to call the same script that posted the data without causing an error!

 

I'm looking for some cleaver person to help me out with a suggestion.

Link to comment
Share on other sites

It's not ideal, but looking at the documentation, if you could run a PHP script on your server using system(), the duration of that script is not included in the time-out, so even if the script takes an hour to complete, as long as you spend less than 30 seconds outside of that system() call, you'll be fine.  Put your image processing in that external script, pass it the parameters it needs to know what to do, and you're set.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.