[wp-trac] [WordPress Trac] #31050: Better PDF Upload Management

WordPress Trac noreply at wordpress.org
Tue Oct 25 23:10:06 UTC 2016


#31050: Better PDF Upload Management
-------------------------------------------------+-------------------------
 Reporter:  celloexpressions                     |       Owner:
     Type:  feature request                      |  mikeschroder
 Priority:  normal                               |      Status:  assigned
Component:  Media                                |   Milestone:  4.7
 Severity:  normal                               |     Version:
 Keywords:  has-patch needs-unit-tests needs-    |  Resolution:
  testing                                        |     Focuses:  ui
-------------------------------------------------+-------------------------

Comment (by joemcgill):

 [attachment:31050.3.diff] is working much better on the performance front.
 [attachment:31050.4.diff] cleans up a few things:

 1. Since we're saving the attachment metadata similarly to how images save
 data, most of the internal image functions work just fine, so I've removed
 some changes to `image_downsize()` that seemed unnecessary.
 2. I fixed two issues with the way orientations were being calculated.
 First, in `wp_prepare_attachment_for_js()` when we use the sizes fallback
 to set the full size data we were calculating the orientation in reverse.
 While it's simple to do this calculation, I'm not against adding a helper
 function as @markoheijnen suggested on Slack. I also fixed a typo which
 meant we were failing to set the orientation, height, and width attributes
 for the response.
 3. The only other change is to go back to the default size and crop
 attributes for image sizes in `wp_generate_attachment_metadata()`, which I
 don't feel strongly about if there is a good reason to hard code those
 values in.

 Remaining issues I see:

 1. On the edit media screen `wp-admin/post.php?action=edit` the thumbnail
 is not showing up for PDFs because it's attempting to use the attachment
 file and not the thumbnail image.
 2. I'm not confident that adding the `attachment_fallback_mimetypes`
 filter is needed here since any mimes that are added to that array might
 need its own process for creating a fallback image rather than using the
 same process we use for PDFs.

 I'm going to keep testing, but otherwise this looks good.

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


More information about the wp-trac mailing list