getimagesize returning nothing
Posted: Fri Aug 03, 2007 12:33 pm
I have a function called checkUpload() which is suppose to check the attributes a file to be uploaded. If it passes all the checks, the file is uploaded. The only types of files to be uploaded are images [which will be filtered later], but I'm trying to get the image x and image y [without using GD].
Here is my code:
And this is what is returned:
Thanks.
Here is my code:
Code: Select all
$uploaddir = "/var/www/upload/";
$uploadfile = $uploaddir . basename($_FILES['uploadedfile']['name']);
$path_parts = pathinfo($uploadfile);
/********DEBUG INFO********/
echo "Max Image Width: $tl_maxwidth<br />";
echo "Max Image Height: $tl_maxheight<br />";
echo "Upload Directory: $uploaddir<br />";
echo "Upload Directory exists: " . is_dir($uploaddir) . "<br />";
echo "Upload Directory is writable: " . is_writable($uploaddir) . "<br />";
echo "Upload Properties: " . print_r($_FILES) . "<br />";
echo "Max Upload size is: " . ini_get('post_max_size') . "<br />";
$size = getimagesize($uploadfile);
echo "Image Width: " . $size[0] . "<br />";
echo "Image Height: " . $size[1] . "<br />";
/**************************/The size is not being returned. I've tried this for 2 PNG images and 1 JPG image, and none of them worked. However, I tried this for a GIF image and it worked.Max Image Width: 400
Max Image Height: 60
Upload Directory: /var/www/upload/
Upload Directory exists: 1
Upload Directory is writable: 1
Array ( [uploadedfile] => Array ( [name] => banner1.png [type] => image/png [tmp_name] => /tmp/phpLgol7D [error] => 0 [size] => 46580 ) ) Upload Properties: 1
Max Upload size is: 8M
Image Width:
Image Height:
I'm not really sure what's wrong. Can anyone shed some light on this?Max Image Width: 400
Max Image Height: 60
Upload Directory: /var/www/upload/
Upload Directory exists: 1
Upload Directory is writable: 1
Array ( [uploadedfile] => Array ( [name] => 88x31_2.GIF [type] => image/gif [tmp_name] => /tmp/php117DHw [error] => 0 [size] => 3441 ) ) Upload Properties: 1
Max Upload size is: 8M
Image Width: 88
Image Height: 31
Thanks.