[wp-trac] [WordPress Trac] #38522: HTTP Errors on Upload with Certain PDFs

WordPress Trac noreply at wordpress.org
Mon Oct 31 22:24:41 UTC 2016


#38522: HTTP Errors on Upload with Certain PDFs
--------------------------+---------------------------
 Reporter:  mikeschroder  |       Owner:  mikeschroder
     Type:  defect (bug)  |      Status:  assigned
 Priority:  normal        |   Milestone:  4.7
Component:  Media         |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+---------------------------

Comment (by mikeschroder):

 Replying to [comment:4 dglingren]:
 > I have done some preliminary testing with the 4.7 Beta 1 release. PDF
 thumbnail generation generally works great (congratulations!).
 Thanks for testing!

 > However, with very large PDF documents I found two issues:
 >
 > 1. WP 4.7 thumbnail generation for a 32,953KB document takes 4 minutes
 37 seconds (4:37) on my system. With WordPress 4.6.1, uploading takes 6.35
 seconds, and using the thumbnail generator in Media Library Assistant
 (MLA) takes just 5.37 seconds (0:06) . I suspect the difference is because
 the generation technique in WP 4.7 processes the entire PDF document while
 MLA uses an explicit GhostScript invocation to process just the first page
 (I haven't looked at the code yet).

 It may be partially directly calling GhostScript, but I suspect the
 largest time difference is that WordPress is rendering at 128dpi, while
 MLA renders at 72dpi by default.  72dpi is enough for a small thumbnail,
 but wasn't high enough resolution to generate clear previews for
 Attachment Details.

 You can test to see if this is the case or not by either changing
 [https://core.trac.wordpress.org/browser/trunk/src/wp-includes/class-wp-
 image-editor-imagick.php#L154 the line] from `128, 128` to `72, 72`, or
 commenting out the if statement/`setResolution` in entirely, since 72dpi
 is Imagick's default.

 > 2. I used the drag-and-drop uploader (in the Media/Add New screen) to
 process four large PDF documents (about 23MB each) with similar names. The
 WP 4.7 process sometimes failed with an HTTP Error, but it also generated
 multiple copies of some files and thumbnail images for each copy.

 Did the ones that fail have a large amount of pages?  Any that you can
 share for testing would be appreciated.

 I think in the end, we're going to need to provide a better error message
 (as mentioned in the title), since some PDFs are going to fail
 thumbnailing due to time or RAM no matter what platform they're on. The
 trick is figuring out how to best detect or prevent the case, while still
 showing a true error if the upload failed entirely.

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


More information about the wp-trac mailing list