[wp-trac] [WordPress Trac] #35094: Replace static with Dynamic Image Sizes for inserted images

WordPress Trac noreply at wordpress.org
Sat Mar 26 11:12:35 UTC 2016


#35094: Replace static with Dynamic Image Sizes for inserted images
-------------------------+------------------------------
 Reporter:  mor10        |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Media        |     Version:  trunk
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:  administration
-------------------------+------------------------------

Comment (by jaspermdegroot):

 Replying to @mor10:

 I think that for images inside the content that the user should keep
 control over the image size, not the theme author. So the image size
 should remain the size that has been set in the media settings menu.

 However, I do agree that constraining of images to the content width and
 setting the corresponding `width` and `height` attributes should be based
 on the current active theme, not on the one that was active while the
 image was inserted.

 I don't agree that `width` and `height` attributes don't serve a practical
 purpose anymore now that we landed responsive images in core. They tell
 the browser the dimensions of the `img` element while the `srcset` and
 `sizes` attributes are about what to load into that element. `sizes` only
 provides the browser information to help selecting the best source. It
 doesn't tell the browser at what size to render the image element.

 Actually the responsive image functions that we added depend on the
 `width` and `height` attributes. If we would leave it up to theme authors
 to set image dimensions in their stylesheet we wouldn't know what to set
 for the `sizes` attribute.

 Theme authors would only set `max-width: 100%; height: auto;` and a
 specific `width` for the "thumbnail", "medium", and "large" classes. This
 means that full size images won't have a `width` set anymore, while this
 is important for performance. Images already get a `size-[size-name|full]`
 class by the way.

 We should also look into constraining the full size image to the content
 width of the active theme. Currently the `sizes` attribute is based on the
 unconstrained width and the `src` image is always included in the `srcset`
 so in case of full size images that are wider than the content, the
 browser probably loads the too big uncompressed original image.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35094#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list