Make WordPress Core

Opened 5 years ago

Last modified 3 years ago

#39262 new enhancement

Fall back to ImageMagick command line when the pecl imagic is not available on the server — at Version 2

Reported by: Hristo Sg Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.7
Component: Media Keywords:
Focuses: performance Cc:

Description (last modified by dd32)

The patch allows WordPress to fall back to the ImageMagick command line when the imagic pecl is not available on the server. Patch attached.

Change History (3)

@Hristo Sg
5 years ago

The patch for falling back to command line

#1 @Hristo Sg
5 years ago

Here are the performance test we've done so far:

CPU - Total number of CPU-seconds that the process used directly (in user mode), in seconds.
MaxRSS - Maximum resident set size of the process during its lifetime, in Kilobytes.

PHP 7.0 - no imagick loaded - MaxRSS: 93261 CPU user: 0.0204
PHP 7.0 - imagick loaded - MaxRSS: 118094 CPU user: 0.0742
PHP 7.1 - no imagick loaded - MaxRSS: 50444 CPU user: 0.0144
PHP 7.1 - imagick loaded: MaxRSS: 82350 CPU user: 0.0678
Curl requests to phpinfo comparison (1 request per second - 5 min):
PHP 7.0 (no imagick)- Average response time: 0.071818 ms |Number of requests: 300
PHP 7.0 (with imagick) - Average response time: 0.143573 ms |Number of requests: 300

Performed tests and added results for PHP 5.6
PHP 5.6 - no imagick loaded - MaxRSS: 60400 CPU user: 0.019
PHP 5.6 - imagick loaded - MaxRSS: 85870 CPU user: 0.080
Curl requests to phpinfo comparison (1 request per second - 5 min):
PHP 5.6 (no imagick)- Average response time: 0.059901 ms |Number of requests: 300
PHP 5.6 (with imagick) - Average response time: 0.134315 ms |Number of requests: 300

#2 @dd32
5 years ago

  • Description modified (diff)

Just a note that i've removed the contents of the diff from the ticket description to make it easier to read.

Hi and welcome back to Trac.

Just to note that there was some discussion related to the usage of the external commands in 33:ticket:6821 of the original ticket.
My concerns still remain from that ticket - in that I don't think WordPress should be shelling out to perform commands.

Quick look at the patch points to issue in update_size() - not escaping the width/height variables, and shell_exec() doesn't throw exceptions.

I think this would be great as a plugin myself.

Note: See TracTickets for help on using tickets.