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!
Link to comment
Share on other sites

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?
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.