bobinindia Posted April 18, 2008 Share Posted April 18, 2008 I am uploading images and then resampling them using GD. If someone uploads a 5mb image it takes a while to be resampled. I want the upload script to trigger the resampling script and then complete itself while the resampling is still going on. User doesn't have to wait. Possible?? Link to comment https://forums.phpfreaks.com/topic/101767-can-php-trigger-another-php-script/ Share on other sites More sharing options...
dennismonsewicz Posted April 18, 2008 Share Posted April 18, 2008 I think you may be able to use cookies and then write an if statement that says if cookie last this long then execute this script. Then again I could be way off base on this one Link to comment https://forums.phpfreaks.com/topic/101767-can-php-trigger-another-php-script/#findComment-520687 Share on other sites More sharing options...
bobinindia Posted April 18, 2008 Author Share Posted April 18, 2008 how would the cookie trigger the script? Link to comment https://forums.phpfreaks.com/topic/101767-can-php-trigger-another-php-script/#findComment-520690 Share on other sites More sharing options...
dennismonsewicz Posted April 18, 2008 Share Posted April 18, 2008 Sorry actually after re-thinking this, I don't think you can use cookies Link to comment https://forums.phpfreaks.com/topic/101767-can-php-trigger-another-php-script/#findComment-520696 Share on other sites More sharing options...
dennismonsewicz Posted April 18, 2008 Share Posted April 18, 2008 try looking through this http://de2.php.net/manual/en/function.set-time-limit.php Link to comment https://forums.phpfreaks.com/topic/101767-can-php-trigger-another-php-script/#findComment-520698 Share on other sites More sharing options...
miracle_potential Posted April 18, 2008 Share Posted April 18, 2008 The only thing I can think of is using a class and you call it with the new $method; function. Although i'm not sure really this should be a single file that you put into a page in an I-Frame so people can still half use the site. Not sure how to go about it but give using a class a go with I-Frames. Link to comment https://forums.phpfreaks.com/topic/101767-can-php-trigger-another-php-script/#findComment-520703 Share on other sites More sharing options...
BlueSkyIS Posted April 18, 2008 Share Posted April 18, 2008 the method that i have used in the past is to run a cron job that checks for a new upload (or whatever) and processes it when found. after the process is complete, the record for the updated file is updated to 'complete' (or whatever), so PHP can tell the process is finished and let the user know. Link to comment https://forums.phpfreaks.com/topic/101767-can-php-trigger-another-php-script/#findComment-520707 Share on other sites More sharing options...
Xeoncross Posted April 18, 2008 Share Posted April 18, 2008 You can't do this in PHP. You need to use JS (like mootools.net) to send an AJAX request to the server and have one instance of PHP cropping the image and the user will be free to go on and send more ajax requests or visit another page without killing the cropper PHP request. The second way would be to upload the file and add a record a database table "crop_jobs" that is checked by cron on the server every 10-30mins and all filenames in that table are cropped and the DB rows deleted without need for the users do wait for the process. In the mean time you could just say "server is processing your image" on each page. You can't start a php request and go on to something else and expect it to continue. I.E. "set_time_limit", "die()", or "exit();". Link to comment https://forums.phpfreaks.com/topic/101767-can-php-trigger-another-php-script/#findComment-520719 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.