Reply to Re: Uploading large dimension image failed to resize and upload

Re: Uploading large dimension image failed to resize and upload new!
by Christian, 4 years ago
I am using this awesome class to my application, it resizes the users large image and it works well. Until I got some reports from them that upon uploading their image the page turns blank. I request them to send the original image to me.
I tried it on my side, and I got the same blank page upon uploading, I try to increase the memory limit etc on my server but it was the same. How can we resize this kind of images. The image has a large dimension.
Dimensions: 11501px(width) x 14883px(height)
Size: 4.05 MB

This is the code I am using:
$orig_img = $_FILES['image']['tmp_name'];
list($width, $height, $type, $attr) = getimagesize( $orig_img );
$file_name = (rand(1, 99999999999));

$folder = "uploads";
$upload_date = date("M-d-Y");

$destination_path = dirname(__FILE__) . "/" . $folder . "/" . $upload_date . "/";
if ($file_name) $file_location = "/".$upload_date . "/" . $file_name.".".$file_ext;

$handle = new \Upload($_FILES['image']);
if ($handle->uploaded) {

    if($width > 1000){
        $handle->file_new_name_body = $file_name;
        $handle->image_resize = true;
        $handle->image_ratio_y = true;
        $handle->image_x = 1000;
        $handle->file_overwrite = true;
        $handle->process($destination_path);
    }else{
        $handle->file_new_name_body = $file_name;
        $handle->process($destination_path);
    }

    if ($handle->processed) {
        #echo 'done image resized';
        $handle->clean();
    } else {
        #echo 'error : ' . $handle->error;
    }
}
Reply

Your reply

Name *
Email 
Title *
Text *
CAPTCHA image
Enter the code displayed on the image:
Click on the image to generate another one if it is hard to read it. The case is important