Jump to content

Allowed memory size of 16777216 bytes exhausted...


cs.punk

Recommended Posts

When resizing images of bigger sizes than 300kb (I'm not sure exactly, but that's the figure I estimate) with my home brewed function (image_resize).

 

I get this error:

Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 2304 bytes) in D:\Web Server\xampplite\htdocs\functions\image_resize.php on line 19

 

Of which line 19 is

$tmp_image = imagecreatefromjpeg ($original_image);

 

Why is it using more than 16MB of RAM? When it seems to be just trying to use less than 2kb?

And how do I increase this limit?

 

Link to comment
Share on other sites

"Why is it using more than 16MB of RAM? When it seems to be just trying to use less than 2kb?"

 

This particular aspect of your script is not using more than 16Mb of ram, everything being run by PHP in that instance is using a total of more than 16Mb.

 

"And how do I increase this limit?"

 

The variable is memory_limit in your php.ini

 

If this is a shared server you likely do not have access to adjust this value however you can usually do so via your code as well using this at the top of your page.

 

ini_set("memory_limit","32M");

 

where 32M is the new value for PHP Memory.

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.