views:

30

answers:

1

i am uploading image to s3 server and by php i am making a copy of that image on server , if i upload an image of 2.3 mb than the width of image is not coming but if i upload less size image like 26kb than it is showing the width of image so it is able to create the copy .

here is my code of php :

$s3 = new S3(awsAccessKey, awsSecretKey);

        $thumbId = uniqid();
        $thumbId .= ".jpg"; 
        $img = '';

        if($imgType == "image/jpeg"){
            $img = imagecreatefromjpeg($sourceUrl);
        }else if($imgType == "image/png"){
            $img = imagecreatefrompng($sourceUrl);
        }else if($imgType == "image/gif"){
            $img = imagecreatefromgif($sourceUrl);
        }else{
            $img = imagejpeg($sourceUrl);
        }

    echo    $width = imagesx( $img );
        echo $height = imagesy( $img );

please tell me what is the problem with size of image..

regards

rahul

+2  A: 

I can be wrong, but I am fairly sure this is a memory issue that doesn't get displayed because some aspect of error reporting is turned off.

Either that, or the 2.3 MB image is broken or in a format that GD can't read - make sure you try it with various images.

If it's a memory issue, here is a related question.

Pekka
i have tried less than 1024 kb that is wokring fine and php.ini memory limit is 160M -- then what may be the problem
Rahul Mehta
@Rahul what physical dimensions do the image files have? The file size is irrelevant with JPG, the width x height is important. Also, you are still not telling *what* happens exactly. What values go you get with a large image?
Pekka
blank values are coming with big images
Rahul Mehta
the big image 2.3 mb is of size 1024x768 and small image of 0.9 mb is 4351x3000
Rahul Mehta
@Rahul what does "blank values" mean exactly. Is anything output at all? What happens if you add a `echo "test";`? Did you try my `ini_set` suggestion from above?
Pekka
yeah i have tried ini_set('display_errors', true) also no error comes
Rahul Mehta