Filter the attachment image attributes for the Twenty Seventeen theme. #1321
Per issue #1237, the Twenty Seventeen theme is adding
AMP uses a combination of the
This PR filters
Notice the differences in non-AMP vs. AMP rendering before this PR is applied. The images are stretched due to the
Here is a 150x150 thumbnail image before this PR is applied:
Here is a 1200w image before this PR is applied:
Now let's compare both of the above images after applying this PR. Notice the images render the same in non-AMP and AMP modes without stretching.
Is this a fix or bandaid?
There is an open issue with the AMPHTML project about images being stretched. IMO this PR fixes the layout and sizes for the Twenty Seventeen theme as it is adjusting the sizes to
The text was updated successfully, but these errors were encountered:
…hment page. Per issue #1237, the Twenty Seventeen theme is adding `$attr['sizes'] = '100vw';` which stretches images on the attachment page when in AMP mode. This commit filters 'wp_get_attachment_image_attributes' to change the layout to responsive and sizes to the image sizes per `wp_get_attachment_image_sizes()`. AMP uses these attributes to render the <amp-img>.