[wp-trac] [WordPress Trac] #39262: Fall back to ImageMagick command line when the pecl imagic is not available on the server

WordPress Trac noreply at wordpress.org
Fri Dec 16 12:45:30 UTC 2016


#39262: Fall back to ImageMagick command line when the pecl imagic is not available
on the server
--------------------------------+------------------------------
 Reporter:  Hristo Sg           |       Owner:
     Type:  enhancement         |      Status:  new
 Priority:  normal              |   Milestone:  Awaiting Review
Component:  External Libraries  |     Version:  4.7
 Severity:  normal              |  Resolution:
 Keywords:                      |     Focuses:
--------------------------------+------------------------------

Comment (by gitlost):

 Looking at `supports_mime_type()` in the suggested
 `WP_Image_Editor_Imagick_External` class and it explicitly only supporting
 PDFs prompts the question why use ImageMagick at all for the production of
 PDF previews - why not just shell out to GhostScript directly?

 ImageMagick itself is as mentioned just a bridge, shelling out to
 GhostScript, and a klunky bridge at that as I found (#39216) when trying
 to fix issues with PDFs with CMYK color spaces, with as far as I could see
 no way via ImageMagick (due to the PAM intermediate format) to utilize the
 default ICM/ICC profile handling contained in GhostScript.

 In producing PDF previews (see
 https://core.trac.wordpress.org/browser/trunk/src/wp-
 admin/includes/image.php#L237), no manipulation is done using the Imagick
 editor that creates the "full" preview jpeg, it's just thrown away and the
 jpeg reopened in a new (Imagick) editor. So it would make sense to me to
 produce the "full" preview using a GhostScript-based editor dedicated to
 that (or indeed a direct conversion function, but that's another story).
 The following patch (only tested on Ubuntu) is a proof of concept of this.

 The shared hosts overload issues mentioned in ticket:6821#comment:33
 shouldn't be affected (and should presumably be lessened) by using
 GhostScript directly given that ImageMagick does it itself. The security
 issues mentioned may still need to be addressed, but should be
 surmountable I'd have thought with a careful enough implementation (no
 doubt more careful than in the attached patch).

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39262#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list