PDA

View Full Version : Image manipulation GD/PHP v ImageMagick exec()


phppete
05-23-2008, 04:40 AM
I just want to confirm something, when resizing images with GD lib and PHP the memory limit is 32MB, do the same memory limits apply when using 'convert' executed through PHP's exec() function?

The reason I ask is because on one site I noticed the memory exceeded 32MB for GD using the open source TinyMCE image manager where as I haven't experienced this on my own custom scripts that use imagemagick with exec().

Am I also correct in assuming imagemagick will use less memory than GD for the exact same task? If a FQ staff member could clarify some of this I would be most grateful, I always like to ensure I am a considerate neighbour. FWIW these image tasks are very infrequent and done within a protected admin and this is the first time I have seen this problem with TinyMCE image manager. It would appear the issue could be with cropping images rather than resizing.

Thank you.

Terra
05-23-2008, 01:39 PM
I'm not sure on the memory usage difference between ImageMagick and GD, as differing image manipulations can impact memory in various ways depending on the code path taken... Each does their own thing...

As far as exec()'ing out, you should get a memory footprint of 64MB to work with, instead of the 32MB limit that PHP imposes... Each Apache daemon runs under a 64MB ulimit (for safety), however PHP has its own internal memory limit set to 32MB that is controlled by its own emalloc library...

Overall, if you hit a memory limit, then some optimization needs to be done to lessen its usage... If optimization isn't enough, then the site would need to move to a MQS were memory tweaking can be done...