[wp-trac] [WordPress Trac] #36534: Media Upload Issue Since 4.5 Upgrade

WordPress Trac noreply at wordpress.org
Sat May 28 17:41:32 UTC 2016


#36534: Media Upload Issue Since 4.5 Upgrade
-------------------------------------+------------------------
 Reporter:  unicornbacon             |       Owner:  joemcgill
     Type:  defect (bug)             |      Status:  reopened
 Priority:  normal                   |   Milestone:  4.5.3
Component:  Media                    |     Version:  4.5
 Severity:  major                    |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+------------------------

Comment (by joemcgill):

 While doing additional profiling/research for this ticket, I'm noticing
 that the new compression settings introduced in 4.5 can result in an
 increase in total wall time while creating images, while memory used is
 generally the same, so we could be running into time limits that are being
 applied to ImageMagick on hosts (via their policy.xml settings, for
 example). Here's the data from an example run:

 '''XHProf run of an image in 4.5'''
 Total Incl. Wall Time (microsec):       2,018,447 microsecs
 Total Incl. CPU (microsecs):    1,851,793 microsecs
 Total Incl. MemUse (bytes):     4,452,312 bytes
 Total Incl. PeakMemUse (bytes): 4,805,744 bytes

 '''XHProf run of an image in 4.4'''
 Total Incl. Wall Time (microsec):       1,676,827 microsecs
 Total Incl. CPU (microsecs):    1,092,302 microsecs
 Total Incl. MemUse (bytes):     4,449,392 bytes
 Total Incl. PeakMemUse (bytes): 4,794,664 bytes

 The difference is almost entirely a result of the switch to using
 `Imagick::resizeimage` instead of `Imagick::scaleimage` introduced in
 [36891]. We're using Imagick's `FILTER_TRIANGLE` within the
 `resizeImage()` function, which produces the best results considering file
 size savings, image quality, and performance, but is still more resource
 intensive than if we were to use `FILTER_BOX` which is the default (I
 believe).

 While `WP_Image_Editor_Imagick::thumbnail_image()` accepts alternate
 filters as a parameter, there really is no easy way for users to alter
 this value unless we were to add a filter before `Imagick::resizeimage` is
 called.

 We may also be able to check the value of `Imagick::getResourceLimit` and
 conditionally use the `FILTER_BOX` filter when the available resource time
 is low, but I'm not sure.

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


More information about the wp-trac mailing list