Should I use a PHP extension for ImageMagick or just use PHP's Exec() function to run the terminal commands?

后端 未结 3 1436
既然无缘
既然无缘 2021-01-03 04:56

I need to do the following image manipulations for images uploaded by users on my site:

  1. Resize images (if greater than a certain dimension)
  2. Convert al
3条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-03 05:33

    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.

提交回复
热议问题