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.
Hi, First off, great class and amazing functionality!
But, I have a problem when uploading and resizing a particular image which causes a "white screen of death"- there is no html or source code. I am guessing it is to do with the image (pixel) size but I don't remember seeing any restrictions mentioned. All other (smaller) images have worked , no problem...
The code generates three images of different sizes, but they all use the same parameters as the snippet below.
I did an 'echo $handle->log' and got this for the large (2816x2112px) img: system information - GD version : 2.0.28 - supported image types : png jpg gif bmp - open_basedir : /home/mesamisweb/:/tmp:/usr/local/lib/php/ - language : en_GB source is an uploaded file - upload OK - file name OK - source variables file_src_name : P3080003.JPG file_src_name_body : P3080003 file_src_name_ext : jpg file_src_pathname : /tmp/phpPeJNgY file_src_mime : image/jpeg file_src_size : 1426053 (max= 2097152) file_src_error : 0 - source file is an image image_src_x : 2816 image_src_y : 2112 image_src_pixels : 5947392 image_src_type : jpg image_src_bits : 8
and this for a smaller image: system information - GD version : 2.0.28 - supported image types : png jpg gif bmp - open_basedir : /home/mesamisweb/:/tmp:/usr/local/lib/php/ - language : en_GB source is an uploaded file - upload OK - file name OK - source variables file_src_name : P3080003_b.jpg file_src_name_body : P3080003_b file_src_name_ext : jpg file_src_pathname : /tmp/phph40TIK file_src_mime : image/jpeg file_src_size : 364874 (max= 2097152) file_src_error : 0 - source file is an image image_src_x : 1408 image_src_y : 1056 image_src_pixels : 1486848 image_src_type : jpg image_src_bits : 8
I am doing a header redirect after processing and get the usual php warning messages about not being able to do a redirect (due to writing log to screen) ONLY after the smaller image upload.
Hope you can help! (I can send you the image if you want.) Thanks ChamanReply
You need to raise the PHP memory limit, usually in php.ini. On shared hosting, you probably can't edit your php.ini, so you can try the following, although it will work only if the hosting company allows it, which they usually don't.
You can add this in your script:
ini_set ( "memory_limit", "40M")
Or in a .htaccess file:
php_value memory_limit 40M
If the above doesn't work, ask your hosting company.Reply
First off, great class and amazing functionality!
But, I have a problem when uploading and resizing a particular image which causes a "white screen of death"- there is no html or source code. I am guessing it is to do with the image (pixel) size but I don't remember seeing any restrictions mentioned. All other (smaller) images have worked , no problem...
The code generates three images of different sizes, but they all use the same parameters as the snippet below.
I did an 'echo $handle->log' and got this for the large (2816x2112px) img:
system information
- GD version : 2.0.28
- supported image types : png jpg gif bmp
- open_basedir : /home/mesamisweb/:/tmp:/usr/local/lib/php/
- language : en_GB
source is an uploaded file
- upload OK
- file name OK
- source variables
file_src_name : P3080003.JPG
file_src_name_body : P3080003
file_src_name_ext : jpg
file_src_pathname : /tmp/phpPeJNgY
file_src_mime : image/jpeg
file_src_size : 1426053 (max= 2097152)
file_src_error : 0
- source file is an image
image_src_x : 2816
image_src_y : 2112
image_src_pixels : 5947392
image_src_type : jpg
image_src_bits : 8
and this for a smaller image:
system information
- GD version : 2.0.28
- supported image types : png jpg gif bmp
- open_basedir : /home/mesamisweb/:/tmp:/usr/local/lib/php/
- language : en_GB
source is an uploaded file
- upload OK
- file name OK
- source variables
file_src_name : P3080003_b.jpg
file_src_name_body : P3080003_b
file_src_name_ext : jpg
file_src_pathname : /tmp/phph40TIK
file_src_mime : image/jpeg
file_src_size : 364874 (max= 2097152)
file_src_error : 0
- source file is an image
image_src_x : 1408
image_src_y : 1056
image_src_pixels : 1486848
image_src_type : jpg
image_src_bits : 8
I am doing a header redirect after processing and get the usual php warning messages about not being able to do a redirect (due to writing log to screen) ONLY after the smaller image upload.
Hope you can help! (I can send you the image if you want.)
Thanks
Chaman
Search for memory in the site, or click here.
You can also check this post.
You need to raise the PHP memory limit, usually in php.ini. On shared hosting, you probably can't edit your php.ini, so you can try the following, although it will work only if the hosting company allows it, which they usually don't.
You can add this in your script:
Or in a .htaccess file:
If the above doesn't work, ask your hosting company.