[wp-trac] [WordPress Trac] #34477: Pass the named image size to the filter in `wp_get_attachment_image_sizes()`
WordPress Trac
noreply at wordpress.org
Sat Oct 31 01:59:58 UTC 2015
#34477: Pass the named image size to the filter in
`wp_get_attachment_image_sizes()`
--------------------------+-----------------------
Reporter: joemcgill | Owner: azaozz
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 4.4
Component: Media | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
--------------------------+-----------------------
Comment (by azaozz):
I'm still somewhat uncomfortable with this change.
To generate the `sizes` attribute value we need the image width as set in
the `width` attribute (in the tag). All other parameters passed to
`wp_get_attachment_image_sizes()` are purely for use in the filter.
At both places where core uses this function, we know the image width.
However we don't use that width because some plugins might need the named
image size. However in some cases we won't know the image size, and in
some (rare) edge cases it may be different than the actual image,
resulting in wrong value.
Logically we should use the "proper" width that we have, and pass the
named image size as an optional parameter. I know that makes brings the
number of params on that function to 1 required and used, plus 3 optional
and not used, but still thinking that's better.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34477#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list