Conversation
@adamsilverstein did you add the hook for the |
The entire PR is for testing. |
|
reopening to bring this PR up to date... |
4392bec to
1ebc2ec
Compare
picture element support
joemcgill
left a comment
There was a problem hiding this comment.
This is looking good and surprisingly doesn't seem to impact default styling of images even though the markup changes. Left a couple of questions.
| // If the original mime types is the only one available, no picture element is needed. | ||
| if ( 1 === count( $mime_types ) && $mime_types[0] === $original_file_mime_type ) { | ||
| return $image; | ||
| } |
There was a problem hiding this comment.
For sites that don't support AVIF or WebP, if someone uploads an original in one of those formats, won't all the intermediate sizes be JPEG? If so, do we want this to result in using picture or would a simple img element be preferred?
There was a problem hiding this comment.
I haven't tested with WebP support missing, but my expectation is that you shouldn't be able to upload a WebP image if your server doesn't support it. This may not be working correctly in the block editor currently, so for now I am referring to uploading in the media library. I'm not sure I have a test version of PHP that doesn't support WebP.
~98% of WordPress sites are on a host that supports WebP so this is an edge case.
There was a problem hiding this comment.
@joemcgill - I created this follow up Issue to work on improving the settings screen in particular when WebP isn't supported.
|
I found that the Settings link was pointing to the "Also output JPEG" checkbox: I've fixed this in 2e68884 so that the settings link points to the entire section. |
Co-authored-by: Weston Ruter <westonruter@google.com>
Co-authored-by: Weston Ruter <westonruter@google.com>
Co-authored-by: Weston Ruter <westonruter@google.com>
Co-authored-by: Weston Ruter <westonruter@google.com>
Nice catch! |
westonruter
left a comment
There was a problem hiding this comment.
With https://github.com/WordPress/performance/pull/73/files#r1619520322 this looks good to go! 🥳
Co-authored-by: Weston Ruter <westonruter@google.com>
Thanks the reviews and feedback🎉 ! |



Fixes #21
Closes #1236
wp_content_img_tagto potentially wrap (media) images in a picture element.twentysixteen.Picture element and AVIF support by version
AVIF support is being worked on and
pictureelement support can be especially useful for adding AVIFs to your site if you have users on browsers that don't support AVIF.pictureSupport (Version, Date)