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

WordPress Trac noreply at wordpress.org
Wed Oct 28 01:52:43 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 needs-testing  |     Focuses:
-------------------------------------+------------------------

Comment (by joemcgill):

 [attachment:34430.5.diff] is another iteration which introduces a few
 notable changes.

 First, `wp_get_attachment_image_srcset_array()` has been removed in favor
 of the lower level function, `_wp_calculate_image_srcset()` which accepts
 a URL, image meta, and a size array comprised of a width and height value.

 The generation of these parameters are now handled in
 `wp_get_attachment_image_srcset()` which is meant to be used in templates
 but is no longer used directly in core when adding a `srcset` attribute to
 images in post content or to image markup generated by
 `wp_get_attachment_image()` on the front end. Instead,
 `wp_get_attachment_image()` and `wp_image_add_srcset_and_sizes()` both
 rely  on `_wp_calculate_image_srcset()`. All former filter hooks remain in
 place.

 The other notable change is that the order of parameters for
 `wp_get_attachment_image_sizes()` has changed so that `$attachment_id` can
 be an optional parameter. The order of the parameters in the
 `wp_get_attachment_image_sizes` filter have also been updated to reflect
 this change.

 All tests have been updated accordingly.

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


More information about the wp-trac mailing list