[wp-trac] [WordPress Trac] #34430: Improve the performance of wp_make_content_images_responsive()

WordPress Trac noreply at wordpress.org
Sun Oct 25 04:08:15 UTC 2015


#34430: Improve the performance of wp_make_content_images_responsive()
-----------------------------------+------------------------
 Reporter:  joemcgill              |       Owner:  joemcgill
     Type:  defect (bug)           |      Status:  assigned
 Priority:  normal                 |   Milestone:  4.4
Component:  Media                  |     Version:  trunk
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |     Focuses:
-----------------------------------+------------------------

Comment (by azaozz):

 Replying to [comment:1 joemcgill]:

 Yep, it's moving in the right direction. Got some ideas from the patch and
 went ahead with more changes/fixes.

 In 34430.1.diff:
 - Change `wp_get_attachment_image_srcset_array()` and
 `wp_get_attachment_image_sizes()` to accept the image size (from the image
 tag), image meta and attachment ID as arguments. These are the actual bits
 that are needed to generate `srcset` and `sizes`.
 - Change so the image size argument is always an array of width and
 height. This makes it more precise and avoids any edge cases when the
 default image sizes have been changed by the user. There is an optional
 function to "translate" named sizes into arrays, not used for now and not
 sure if it's needed.
 - Changed so no (other) image API functions are used while generating
 `srcset` and `sizes`.
 - Several logic fixes and improvements.
 - Some names changed to be (hopefully) more descriptive.
 - Fixed/updated the tests.

 Needs more testing that it didn't break anything.

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


More information about the wp-trac mailing list