Jump to content

imagecreatefromjpeg fails on files larger than 1MB


scott212

Recommended Posts

I can't figure it out and I can't get a decent error out of it. In a class I have a basic routine to handle an uploaded image and resize it. It works fine on images less than 1MB but anything over just gives a silent death. I've narrowed it down to the specific 'imagecreatefromjpeg' line by putting prints above and after it and only the top one prints. The line is:

$this->src_image = imagecreatefromjpeg($this->in_image) or die("could not open image");

Please - I'm pulling my hair out!
I checked the max upload size and it's 20MB. The jpg in question has a very large resolution (8000x8000) as a test but file size is only 1.05 MB. Do I need the 'memory_limit' in the php.ini increased? Is there any way to handle this if I can't get it upped?
Doing some more experimenting:

2500x865 @ 758K - pass
3000x990 @ 1099K - pass
5000x1650 @ 865K - fail

So it's the extreme resolutions that are causing the fail
and not the file size. That really leads me to believe that
it's is ram available for processing. I could see putting in a
condition for max width and height, I've just never seen anyone
do that before.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.