incubator-pagespeed-mod icon indicating copy to clipboard operation
incubator-pagespeed-mod copied to clipboard

Optimize images in AMP

Open jeffkaufman opened this issue 8 years ago • 8 comments

If PageSpeed sees <amp-img src=foo srcset=bar> it currently doesn't optimize it by default. You can tell it to optimize the src attribute by setting a UrlValuedAttribute directive:

 UrlValuedAttribute amp-img src image

but (a) this should be on by default and (b) you can't get it to optimize the srcset that way.

jeffkaufman avatar Oct 11 '16 15:10 jeffkaufman

Any updates on optimizing the images inside the srcset ?

Any WordPress instance has this issue:

<img src="https://m.quicoto.com/wp-content/uploads/2017/01/xwp-image-110760650jpg.jpg.pagespeed.ic.ZQXNgOGGqF.webp" srcset="https://m.quicoto.com/wp-content/uploads/2017/01/wp-image-110760650jpg.jpg 2000w, https://m.quicoto.com/wp-content/uploads/2017/01/wp-image-110760650jpg-768x768.jpg 768w, https://m.quicoto.com/wp-content/uploads/2017/01/wp-image-110760650jpg-1024x1024.jpg 1024w" sizes="(max-width: 2000px) 100vw, 2000px">

src is being optimized but not the srcset so user who has a modern browser never uses the optimized version.

quicoto avatar Jan 12 '17 20:01 quicoto

What version of PageSpeed are you using? This should be working with 1.12

jeffkaufman avatar Jan 12 '17 21:01 jeffkaufman

@jeffkaufman I've run

apt-get update
apt-get upgrade

Everything is up to date. Is there a command or file where I can check the pagespeed version?

Thank you.

quicoto avatar Jan 13 '17 07:01 quicoto

If you're on mod-pagespeed-stable then upgrading with apt-get will leave you at the most recent stable release, which is still 1.11 (currently).

To check what version you're running, the easiest way is to go to https://ismodpagespeedworking.com/ (not run by the pagespeed team, but pretty useful!) and see what it shows for the X-Mod-Pagespeed header. For example, for modpagespeed.com I see X-Mod-Pagespeed: 1.12.34.1-0.

jeffkaufman avatar Jan 13 '17 12:01 jeffkaufman

Thanks for the reply @jeffkaufman

It's odd. I enter my domain https://m.quicoto.com/ but it says no mod_speed detected but I clearly have it installed and it is optimizing the HTML. Maybe I have such and old version that it doesn't set the headers? 🤔

quicoto avatar Jan 13 '17 12:01 quicoto

When I manually load the headers for your site I see X-Mod-Pagespeed: 1.11.33.5-0, which is our latest stable version. I'm not sure why ismodpagespeedworking.com doesn't see the same headers.

If you want to stay on the stable track we're planning to re-release 1.12 as stable pretty soon. Or you can switch to beta; either works.

jeffkaufman avatar Jan 13 '17 12:01 jeffkaufman

@jeffkaufman I'll stay on stable. Thanks again. Keep up the good work.

quicoto avatar Jan 13 '17 12:01 quicoto

Hi Still here this issue, with a master branch build (10/6/2019). src in amp-img are optimized but srcset not. I have this UrlValuedAttribute amp-img src image in config file.

Lofesa avatar Jun 11 '19 10:06 Lofesa