[wp-trac] [WordPress Trac] #34379: Responsive Images: Streamline wp_get_attachment_image_sizes()
WordPress Trac
noreply at wordpress.org
Wed Oct 21 01:16:58 UTC 2015
#34379: Responsive Images: Streamline wp_get_attachment_image_sizes()
-------------------------+-----------------------------
Reporter: joemcgill | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Media | Version: trunk
Severity: normal | Keywords: has-patch
Focuses: |
-------------------------+-----------------------------
While working on performance optimizations for
`wp_get_attachment_image_sizes()` I came to the conclusion that we could
drastically simplify the internals of this function without losing any
useful functionality. Originally, the third parameter of this function
would allow a developer to pass in an array of source sizes information
which would be used to build the `sizes` attribute. However, the logic
wasn't transparent and in all cases where this functionality would be
useful, it would be far easier for a developer to simply build the `sizes`
value themselves.
Instead, I'm proposing that the third parameter be used to pass in the
width of the image, which has performance benefits by not making us
recalculate a width that is already known. I'd also like to move the
placement of the filter to the returned value and change the filter name
to 'wp_get_attachment_image_sizes' to be consistent with other filter
names in this family of functions.
I've updated the applicable tests and inline docs.
Aside: @jaspermdegroot was integral in the crafting of this patch and
should be included in any props.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34379>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list