Should I use a PHP extension for ImageMagick or just use PHP's Exec() function to run the terminal commands?
image, image-processing, imagemagick, php
Solution
You would benefit a lot using the PHP extensions instead of using exec or similar functions. Built in extensions will be faster and use less memory as you will not have to spawn new processes and read the output back. The image objects will be directly available in PHP instead of having to read file output, which should make the images easier to work with.
If you have a busy site, creating lots of processes to edit images may start to slow things down and consume additional memory.
Problem
I need to do the following image manipulations for images uploaded by users on my site: - Resize images (if greater than a certain dimension) - Convert all image formats to jpg's - Add a watermark to the bottom of all images Do I need to use either the MagickWand or iMagick extensions or can I just get away with running the terminal commands inside PHP's exec function? Is there a reason why the PHP extensions would be preferred? Which would be faster and better for performance (this site may have lots of users and there would be a ton of image processing at any given time)?