-
Notifications
You must be signed in to change notification settings - Fork 13
Rework featured images to correspond with the correct image sizes. #48
Comments
@westonruter @ThierryA are there currently any plans within the |
@kopepasah Could you indicate where the output is currently incorrect? Below are two example outputs. What is not appearing properly? We can absolutely modify the output of <?php the_post_thumbnail( 'ampconf-375x225' ); ?> 👇 <amp-img width="375" height="225" src="https://src.wordpress-develop.test/wp-content/uploads/2018/01/American_bison_k5680-1-375x225.jpg" class="attachment-ampconf-375x225 size-ampconf-375x225 wp-post-image amp-wp-enforced-sizes" alt="" srcset="https://src.wordpress-develop.test/wp-content/uploads/2018/01/American_bison_k5680-1-375x225.jpg 375w, https://src.wordpress-develop.test/wp-content/uploads/2018/01/American_bison_k5680-1-768x461.jpg 768w, https://src.wordpress-develop.test/wp-content/uploads/2018/01/American_bison_k5680-1-320x192.jpg 320w" sizes="(min-width: 375px) 375px, 100vw"></amp-img> and <?php the_post_thumbnail( 'ampconf-1040x400' ); ?> 👇 <amp-img width="1040" height="400" src="https://src.wordpress-develop.test/wp-content/uploads/2018/01/American_bison_k5680-1-1040x400.jpg" class="attachment-ampconf-1040x400 size-ampconf-1040x400 wp-post-image amp-wp-enforced-sizes" alt="" srcset="https://src.wordpress-develop.test/wp-content/uploads/2018/01/American_bison_k5680-1-1040x400.jpg 1040w, https://src.wordpress-develop.test/wp-content/uploads/2018/01/American_bison_k5680-1-768x295.jpg 768w" sizes="(min-width: 694px) 694px, 100vw"></amp-img> |
@westonruter while it is setting the I was not sure exactly what the Lastly, if we are modifying the images, should this occur within the plugin or theme? I feel that if we come up with a standard for naming images we can rework the Example Name:
Alternatively we could pass attributes to |
@kienstra the call to <img width="2700" height="1761" src="https://src.wordpress-develop.test/wp-content/uploads/2018/01/American_bison_k5680-1-1.jpg" class="attachment- size- wp-post-image" alt="" ampconf-1040x400="" srcset="https://src.wordpress-develop.test/wp-content/uploads/2018/01/American_bison_k5680-1-1.jpg 2700w, https://src.wordpress-develop.test/wp-content/uploads/2018/01/American_bison_k5680-1-1-300x196.jpg 300w, https://src.wordpress-develop.test/wp-content/uploads/2018/01/American_bison_k5680-1-1-768x501.jpg 768w, https://src.wordpress-develop.test/wp-content/uploads/2018/01/American_bison_k5680-1-1-1024x668.jpg 1024w" sizes="(max-width: 2700px) 100vw, 2700px" /> In AMP this gets sanitized as: <amp-img width="1040" height="400" src="https://src.wordpress-develop.test/wp-content/uploads/2018/01/American_bison_k5680-1-1-1040x400.jpg" class="attachment-ampconf-1040x400 size-ampconf-1040x400 wp-post-image amp-wp-enforced-sizes" alt="" srcset="https://src.wordpress-develop.test/wp-content/uploads/2018/01/American_bison_k5680-1-1-1040x400.jpg 1040w, https://src.wordpress-develop.test/wp-content/uploads/2018/01/American_bison_k5680-1-1-768x295.jpg 768w" sizes="(min-width: 694px) 694px, 100vw"></amp-img> This is wrong, yes? Apparently the sanitizer is not doing the right thing, not honoring the width and height specified on the |
Here's the short-term workaround: d26f628 |
@kienstra you could open an issue in the plugin to fix this issue? |
Will Open An Issue Sure, @westonruter. I'll open an issue to address this. Thanks for your workaround commit for reference. |
We may be able to simplify the Still, having control over |
@delawski you can control the <?php ampconf_the_post_thumbnail( 'ampconf-1040x400', array( 'layout' => 'responsive' ) ); ?> The |
Request To Respond To Plugin Issue Hi @kopepasah, |
@westonruter while
|
Within the designs we are provide with very specific image sizes and currently there is no way to represent those image sizes as the
amp-wp
plugin filters the images inAMP_Img_Sanitizer
class. While using the WordPress Core APIthe_post_thumbnail()
does work, it does not output the correct image size, nor does it allow for specific image sizes to be added to thesrcset
ofamp-img
(orimg
before parsing).The text was updated successfully, but these errors were encountered: