I have a page run by Hubspot Blog and an image implementation with srcset
, looking like this:
<img loading="lazy" src="
https://emobility-magazin.com/hs-fs/hubfs/Element%[email protected]?width=480&name=Element%[email protected]"
alt="Element 23@300x" width="480" style="width: 480px;" srcset="
https://emobility-magazin.com/hs-fs/hubfs/Element%[email protected]?width=240&name=Element%[email protected] 240w,
https://emobility-magazin.com/hs-fs/hubfs/Element%[email protected]?width=480&name=Element%[email protected] 480w,
https://emobility-magazin.com/hs-fs/hubfs/Element%[email protected]?width=720&name=Element%[email protected] 720w,
https://emobility-magazin.com/hs-fs/hubfs/Element%[email protected]?width=960&name=Element%[email protected] 960w,
https://emobility-magazin.com/hs-fs/hubfs/Element%[email protected]?width=1200&name=Element%[email protected] 1200w,
https://emobility-magazin.com/hs-fs/hubfs/Element%[email protected]?width=1440&name=Element%[email protected] 1440w"
sizes="(max-width: 480px) 100vw, 480px">
The issue: Google PageSpeed Insights test delivers as an opportunity properly size images
, with a diagnozed problem with the image I mentioned above. It looks like the srcset
doesn't work for PageSpeed Insights test and the image isn't resized properly.
Getting the test data directly through Page Speed Insights API the issue is diagnozed too, on the same way.
But, running the Chrome-own Lighthouse test outta Developer Tools (incognito mode), the issue isn't there - the image seems to be properly resized by srcset
.
My question: is there something, what prevents correct resizing while testing by PageSpeed Insights test? Are there any issues in my srcset implementation? Or is this a kind of bug of PageSpeed Insights?
So there's a couple of things going on here:
width
param supposed to result in different size images being returned?sizes
attribute looks incomplete to me. Maybe that's what's throwing off the browser for point 2?When I run it through https://ausi.github.io/respimagelint/ it gives the following output: