[wp-trac] [WordPress Trac] #36191: Support responsive images in WP_Customize_Media_Control
WordPress Trac
noreply at wordpress.org
Thu Mar 24 02:57:03 UTC 2016
#36191: Support responsive images in WP_Customize_Media_Control
--------------------------+---------------------------------
Reporter: melchoyce | Owner: joemcgill
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: Future Release
Component: Customize | Version:
Severity: normal | Resolution:
Keywords: needs-patch | Focuses: ui, administration
--------------------------+---------------------------------
Changes (by joemcgill):
* keywords: => needs-patch
* owner: => joemcgill
* status: new => assigned
Comment:
There seem to be a couple of challenges here.
The backbone view for the `WP_Customize_Media_Control` relies on data
modeled from `wp_prepare_attachment_for_js()`, i.e., the raw attachment
data, which isn't necessarily the best model for rendering `img` elements
by itself. We probably need to create a general use model that can be
used for `img` data—much like `wp.media.model.PostImage`—where we could
include methods for setting up attributes like `src`, `srcset`, `sizes`,
etc. based on the raw attachment data.
We might be able to fudge it in the mean time by using additional
attachment sizes to create a `srcset` attribute in the
`WP_Customize_Media_Control::content_template()` view, but the template
starts to become logic-heavy at a certain point, and maybe not worth it. I
also worry about sites that have overridden the default sizes and turned
some into hard-crops, which would cause the image to look skewed.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36191#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list