[thelist] Allocating memory for imagecreatefromjpeg

Brooking, John John.Brooking at sappi.com
Thu Feb 9 06:06:17 CST 2006


Hi, all,

   I'm working with the PHP GD library (version 2.0.28, with PHP version 5.1.1, on Apache), and am running into memory problems. On the PHP documentation page for that function[1], two comments (Yaroukh in August, and Karolis in December) discuss this problem and present a workaround involving calculating the amount of memory needed, resetting the PHP memory limit via ini_set('memory_limit', n). Unfortunately, the formula they give does not seem to be giving an accurate estimate. Following their formula, I arrive at a figure that I think I need (16M), and am successfully resetting the limit to it (confirmed by output statements in my program), but the server log still contains "PHP Fatal error:  Allowed memory size of 16777216 bytes exhausted (tried to allocate 2000 bytes) in ...". I can send more information (source code, output, etc.) to anyone who would like to see it, but I don't want to flood the whole list with it.

   Does anyone have any pointers on this, or worked around it in the past? The authors of the comments don't say how they derived their formula, so it would be nice to know that, too. I have emailed them with this question as well, but in case I don't hear back from them, I thought I'd ask it of the wider audience here. Thanks in advance for any information.

- John
-- 

This message may contain information which is private, privileged or confidential and is intended solely for the use of the individual or entity named in the message. If you are not the intended recipient of this message, please notify the sender thereof and destroy / delete the message. Neither the sender nor Sappi Limited (including its subsidiaries and associated companies) shall incur any liability resulting directly or indirectly from accessing any of the attached files which may contain a virus or the like.




More information about the thelist mailing list