#29869 closed defect (bug) (fixed)
Pass $size to wp_get_attachment_image_attributes filter
Reported by: | mattheu | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 4.1 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Media | Keywords: | has-patch |
Focuses: | Cc: |
Description
It would be useful to have access to the originally requested image size in the wp_get_attachment_image_attributes
filter.
Use case: the srcset attribute has recently been introduced - and is useful for adding 2x (3x etc) high res images for devices with high res screens. If plugins were able to access the size in this filter, it could be used to add this.
Somewhat related - but not the same: #14110
Attachments (2)
Change History (8)
#1
follow-up:
↓ 2
@
10 years ago
- Component changed from General to Media
- Milestone changed from Awaiting Review to 4.1
#2
in reply to:
↑ 1
@
10 years ago
Replying to SergeyBiryukov:
$size
cannot be an array at that point, see line 702.
Should we pass that
1024x768
-like string to the filter, or the original requested array?
I vote we store the value of $size
before it's (maybe) modified and pass that to the filter.
#4
@
10 years ago
Updated patch - instead of storing the original value of size I've used a $size_class
variable as I think its a little neater.
$size
cannot be an array at that point, see line 702.Should we pass that
1024x768
-like string to the filter, or the original requested array?