Make WordPress Core

Opened 6 years ago

Last modified 18 months ago

#45813 new defect (bug)

PDF preview images are not generated

Reported by: desrosj's profile desrosj Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Media Keywords:
Focuses: Cc:

Description (last modified by desrosj)

I discovered this when the test suite started failing in my local environment using VVV.

Recently, ImageMagick updated it's policy.xml file to remove rights for PDF files from Ghostscript.

After this change, a WP_Error is returned by `wp_get_image_editor()` when a PDF file is passed. This prevents preview images from being generated and causes the test failures due to lack of metadata.

The PDF tests check that the selected image editor supports PDF images using wp_image_editor_supports() before running, but this does not seem to be catching this change (Imagick::queryFormats() indicates support for PDFs even when rights are removed).

This can be fixed bychanging the rights attribute for PDFs to read|write, or commenting out that line in the /etc/ImageMagick/policy.xml file.

More info: https://alexvanderbist.com/posts/2018/fixing-imagick-error-unauthorized

Change History (15)

#1 @desrosj
6 years ago

Ideally, wp_image_editor_supports() should catch this scenario and correctly indicate that the image editor does not support creating images from a PDF. But, this change will eventually lead to a decline in the number of servers that allow a site to generate preview images.

#2 @desrosj
6 years ago

  • Description modified (diff)

This ticket was mentioned in Slack in #hosting-community by desrosj. View the logs.


6 years ago

#4 @desrosj
6 years ago

  • Milestone changed from Awaiting Review to Future Release

This ticket was mentioned in Slack in #core-media by mike. View the logs.


6 years ago

This ticket was mentioned in Slack in #core-media by mike. View the logs.


5 years ago

#7 @kirasong
5 years ago

We chatted about this in the media meeting this week.

Quick note that I'd love to see a decision re:upstream fix and/or workaround during 5.3.

@desrosj do you want to lead that, or would you prefer someone else do so?
Feel free to assign to me if you'd like.

This ticket was mentioned in Slack in #core-media by mike. View the logs.


5 years ago

This ticket was mentioned in Slack in #core by mike. View the logs.


5 years ago

#11 @SergeyBiryukov
4 years ago

#50573 was marked as a duplicate.

#12 @kirasong
4 years ago

A quick note that it appears to be Ubuntu (and maybe other distros?) that has the changed policy.xml, as ImageMagick does not have PDFs and related files blocked.

As far as I'm aware, the security problem has been fixed upstream, but it'd be a good idea to confirm, then connect with the distro maintainers.

This ticket was mentioned in Slack in #core-media by mike. View the logs.


2 years ago

#15 @Presskopp
18 months ago

Related: #52509

Version 0, edited 18 months ago by Presskopp (next)
Note: See TracTickets for help on using tickets.