|
Posted by shimmyshack on 04/28/07 09:05
On Apr 28, 5:00 am, sandy <relativ...@isrelative.com> wrote:
> I use recursive readdir as the engine for
> a numerous file processing routines, including
> generating thumbnails, using getimagesize
> imagecreatetruecolor and imagejpeg, etc.
> where each resize operation involves instantiating
> a new resizer class instance.
>
> ....but my (shared host) website is large, so I
> run past max_execution_time if I try to make
> all thumbnails at once, from the top of
> my document_root. My virtual file system
> includes a php.ini which I can edit, but
> bumping max_execution-time (although the file saves)
> seems to have no effect, and I do not have
> permission to run /usr/sbin/apachectl restart
>
> Perhaps the php.ini change
> will start to work the next time the server reboots.
>
> In the mean time, is there some way to fork a new process,
> for instantiating the resizer?
>
> I could try to use exec to run command line
> php. But there must be a more elegant way
> to do this. I'd use perl and imagemagick,
> but my shared host server doesn't have the
> right perl libs installed, and that's another
> can of worms.
you could obtain a list of the jobs (or folders) to be processed, put
it in a session, then use an iframe within a main page.
the main page loads the iframe and a javascript function which can
refresh the iframe.
the iframe finishes calls processjob.php which completes job1
job1 is removed from the array
the php script outputs <script>parent.refreshIframe()</script> to the
iframe
the iframe reloads and starts the next job
this is of course a single thread approach, if you want to emulate
more threads, use more iframes where the "parent iframe refresher" now
takes the argument iframename.
don't use too many or you will probably hit other hard limits of
average CPU usage within a certain time, or just RAM.
[Back to original message]
|