phpknight Posted August 4, 2007 Share Posted August 4, 2007 I am having an odd issue with imagecreatefrompng since I upgraded to 5.2.3. It is possible the issue below has nothing to do with it, but that is the major difference. Using imagecreatefrompng on an image that is 1.5 MB, the max memory using is 143 MB. On one that is 16 MB, it is 187 MB. Has anybody had anything similar happen with this? A few months ago, I ran a similar script on a 10MB image, and I did not exceed even 16MB. I would assume the memory should be much, much lower. Quote Link to comment https://forums.phpfreaks.com/topic/63271-imagecreatefrompng-memory-issue/ Share on other sites More sharing options...
ss32 Posted August 4, 2007 Share Posted August 4, 2007 php loads the image into memory as a bitmap. considering PNG's compression, a 10mb png could easily be a 100mb bitmap- its just that good. my suggestion? use smaller images. the fact, though, that 1.5 -> 143 leads me to beleive that there is another issue or a memory leak going on. Quote Link to comment https://forums.phpfreaks.com/topic/63271-imagecreatefrompng-memory-issue/#findComment-315406 Share on other sites More sharing options...
phpknight Posted August 4, 2007 Author Share Posted August 4, 2007 I cannot use smaller images for this application. They have to be huge. Thanks for the compression point. I always thought there were compressionless, but I just realized the compression is lossless, but they still do compress. IF there is a memory leak, it is in the imagecreatefrompng function itself. I do calls before and after that function, and that is where it goes way up. $myMem=memory_get_peak_usage (true); $myMem=$myMem/1000000; print "max memory is $myMem MB before imagecreate<P>"; //here it is .25MB $img_src = imagecreatefrompng( $sourcefile ); $myMem=memory_get_peak_usage (true); $myMem=$myMem/1000000; print "max memory is $myMem MB<P> after imagecreate";//here it is 140+MB Quote Link to comment https://forums.phpfreaks.com/topic/63271-imagecreatefrompng-memory-issue/#findComment-315418 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.