bravo14 Posted December 27, 2017 Share Posted December 27, 2017 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. Quote Link to comment https://forums.phpfreaks.com/topic/306007-allowed-memory-size-of-134217728-bytes-exhausted/ Share on other sites More sharing options...
requinix Posted December 28, 2017 Share Posted December 28, 2017 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? Quote Link to comment https://forums.phpfreaks.com/topic/306007-allowed-memory-size-of-134217728-bytes-exhausted/#findComment-1554940 Share on other sites More sharing options...
phpmillion Posted December 28, 2017 Share Posted December 28, 2017 There's nothing wrong with your script (assuming it's coded properly), the "problem" is related to your server. Quote Link to comment https://forums.phpfreaks.com/topic/306007-allowed-memory-size-of-134217728-bytes-exhausted/#findComment-1554947 Share on other sites More sharing options...
mac_gyver Posted December 28, 2017 Share Posted December 28, 2017 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. 1 Quote Link to comment https://forums.phpfreaks.com/topic/306007-allowed-memory-size-of-134217728-bytes-exhausted/#findComment-1554954 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.