[wp-trac] [WordPress Trac] #34430: Improve the performance of wp_make_content_images_responsive()
WordPress Trac
noreply at wordpress.org
Tue Oct 27 17:33:34 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):
@azaozz [attachment:34430.4.diff] is a riff off of your last patch with
the following changes:
1. Generally, I'd prefer leaving the signature for our `srcset` and
`sizes` functions as is and add the image meta as a third, optional
parameter. My thinking here is that we should optimize the parameters for
developers who would use functions like `wp_get_attachment_image_srcset()`
in a theme or plugin, in which case, passing `$attachment_id` and `$size`
would be consistent with the other `wp_get_attachment_image_` functions.
This change would have no affect on the performance of our display filter.
2. In `wp_get_attachment_image_srcset_array()` calling `path_join()` can
be a bit of a drag on performance, so we should only call it when
absolutely necessary.
3. In `wp_make_content_images_responsive()` we can't assume that all
images with the same ID are using the same markup (e.g., when the same
image is embedded at two sizes on the same page, the same image using
different alignments, etc.). Doing so will result in some images not
getting filtered. This was causing
`Tests_Media:test_wp_make_content_images_responsive()` to fail on my end.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34430#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list