class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
if ($handle->uploaded) {
// we now process the image a second time, with some other settings
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_x = 84;
$handle->image_border = '1px';
$handle->image_border_color = '#FFFFFF';
$handle->file_new_name_body = substr($_POST['current1'],0,-4);
$handle->file_overwrite = true;
$handle->Process($dir_dest);
// we check if everything went OK
if ($handle->processed) {
if ($handle->image_dst_y > 70) $handle->image_crop = array(0,0,($handle->image_dst_y - 70),0);
$handle->Process($dir_dest);
It's giving me a timeout error - PHP Fatal error: Maximum execution time of 30 seconds exceeded in W:\...\_class\class.upload.php on line 4844Reply
Re: Processing a second time after first process? new!
You need to increase the maximum execution time of your script. You can use the PHP function set_time_limit() or change max_execution_time value defined in the php.iniReply
Re: Processing a second time after first process? new!
Can you explain why this should involve any extra time? After all, the original image has already been uploaded and moved. It just needs to be reprocessed, right?Reply
Re: Processing a second time after first process? new!
The time needed is for processing. The upload time is not counted in. It looks like your server must be a little bit slow if it cannot do two processing within 30 secondsReply
Re: Processing a second time after first process? new!
Got it! I needed to restate some of the initial variables again. My code now is this -
if ($handle->uploaded) {
// we now process the image a second time, with some other settings
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_x = 84;
$handle->image_border = '1px';
$handle->image_border_color = '#FFFFFF';
$handle->file_new_name_body = substr($_POST['current1'],0,-4);
$handle->file_overwrite = true;
$handle->Process($dir_dest);
// we check if everything went OK
if ($handle->processed) {
if ($handle->image_dst_y > 70) {
$handle->image_crop = array(0,0,($handle->image_dst_y - 70),0);
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_x = 84;
$handle->image_border = '1px';
$handle->image_border_color = '#FFFFFF';
$handle->file_new_name_body = substr($_POST['current1'],0,-4);
$handle->file_overwrite = true;
$handle->Process($dir_dest);
That seems to work within the 30-second time limit.Reply
However, you'd better use $handle->image_dst_y rather than calling getimagesize()
It's giving me a timeout error -
PHP Fatal error: Maximum execution time of 30 seconds exceeded in W:\...\_class\class.upload.php on line 4844
That seems to work within the 30-second time limit.