Sizes attribute not returned inf response for webp

Hi team,

I’ve noticed that using the html api, the sizes attribute is missing for the webp version of the image when multiple images are in a grid, while the sizes attribute is present in the non-webp version of the image. This results in a bigger image being loaded than necessary.

Builder content link
Link to the html being injected using a dangerouslySetInnerHTML in Nextjs
https://cdn.builder.io/api/v1/html/product-landing-page?apiKey=dc5c96804c6c4a068e9558f30660aaee&userAttributes.urlPath=/test

Detailed steps to reproduce the bug

Screenshots or video link

Code stack you are integrating Builder with
*NextJS

I tried using the content API instead of the html api, but the behaviour is the same.

Thanks!
Vincent

@vperrin Thank you for bringing this to our attention! I have created an internal ticket and will have one of our devs investigate, it does appear to be a bug on our end! We appreciate the feedback and will let you know once we are able to fix!

Excellent, thanks for getting back to me @TimG .

Best,
Vincent

1 Like

Hi @TimG,
I was wondering if there is any update on this ticket and if you would have any timeline to share for resolution?
Thanks!
Vincent

Hey @vperrin thank you for following up on this issue!

I spoke with our dev team again, and we still have a ticket for this in our backlog, currently though it has not been prioritized for work just yet.

That being said, I did a little more digging, and a few things I noticed…1 is that I am seeing this behavior in Chrome, but Firefox for example seems to be displaying the correct images, so it is somewhat browser specific. Also, I noticed that, for example on your homepage even though the URLs for some images was showing width=2000, the images were still maxed out at 969px…which I assume is the size they were uploaded at? The reason I bring this up is to say that our Image API will never “upscale” any images, it will only “downscale” them or have the browser resize the image on render.

All of this is to say, this is definitely an issue worth exploring and further investigating once we have the resources for it, but I don’t think it should result in major performance issues for all users, so hopefully it is not a high priority issue for your site. If you think this is a blocker for your team let me know and we can take that into consideration as we prioritize and scope our work in the coming weeks.

Hope that helps!

Hi @TimG ,
Thanks for getting back to me, I agree that is not a very high priority.
When uploading the images, we didn’t fix the dimensions, so I’m not expecting them to be fixed at 969px.
I don’t know if it is related, but when using running the website through a page speed report, I get the warning that on desktop the images aren’t served in webp format (and pagespeed is based on Chromium)
https://pagespeed.web.dev/report?url=https%3A%2F%2Fwww.sachini.co.uk%2F&form_factor=desktop

Best,
Vincent

Hi @vperrin what format were the images uploaded in?

Hi @TimG ,

All pictures have been uploaded in jpeg format if I’m not mistaken.

Best,
Vincent

ok thank you! I have given this info to our dev team and we will report back with any insights!

My team and I had the same negative experience with the 2000px image variant.
Would be nice to see a fix for it to satisfy angry google bot.
Page performance is money.

Hi @TimG

any updates on this problem?

Regards

Hi @Detzler I just checked on this page: https://www.sachini.co.uk/ again and it looks like the correct sized images are now loading on the page.
I have a recording here: Loom | Free Screen & Video Recording Software | Loom

Let me know if you are seeing a different result on your end or if I am missing something!

Hi @TimG ,

Thanks for investigating and looking into this.
If my understanding is correct, the source set is only used if the sizes attribute is present, which I think is still missing for the webp version.
Also, when I look at the network tab in the dev tools, the image that is transfered over the network is the large one.

Best,
Vincent

Hey @vperrin it looks like you are on a large size desktop in that image, so it should be expected that the large image comes through. When I shrink down to a small view port, I am getting the smaller images in the network tab:

Hi @TimG ,

Thanks for getting back to me.
A few days ago I moved from the html api to the content api because of an issue I had with the html api (see Issue with symbol using custom component).
The situation seems to have improved. I think the only question I have left (but that is probably more like a feature request than a bug), when you have three pictures next to each other or in general when you have pictures that don’t span the entire page, can the srcSet element reflect that? To given an example, if we have three pictures next to each other, the srcSet element for 1600w has now a width of 1600, which 500 would be more than enough given we have three images next to each other.

Hope that makes sense.
Best,
Vincent

1 Like