Jump to content
bravo14

Allowed memory size of 134217728 bytes exhausted

Recommended Posts

Hi all

I am having problems with a script that uploads photo and adds watermarks to them.

 

Whenever I try and upload a photo I get the following error

Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 24576 bytes) in /home/sites/4a/1/13cb47e429/public_html/control/photos/processProduct.php on line 163

Line 163 is

 

 $image = imagecreatefromstring(file_get_contents($photo));

 

Let me know if you need the entire function for this and I will add it, but not sure what is wrong with the script, I have never seen this error before.

Share this post


Link to post
Share on other sites

So what research have you done into what the error message might mean? Any ideas? Just by reading the words in it, what do you think could be the problem?

Share this post


Link to post
Share on other sites

There's nothing wrong with your script (assuming it's coded properly), the "problem" is related to your server.

Share this post


Link to post
Share on other sites

134mb is a significant amount of total memory (unless the image being processed is large/high-resolution), compared to the small amount of new memory trying to be allocated 24kb (unless this part of the code is just for the water-mark source image.) this type of error is usually due to a logic mistake (forever loop) that will consume all available memory, regardless of how much is made available to the script. you could also internationally be making several GD calls as part of the processing (multiple sizes of the source image?), without finishing with the processing of one and freeing up memory before consuming more memory for the next one.

 

if you cannot determine the source of the problem, you will need to post all the code needed to reproduce the problem and indicate the file size, type, and bit size (resolution) of image being uploaded, or even better attach it to a post.

  • Like 1

Share this post


Link to post
Share on other sites

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.