#Astro widths issue

3 messages · Page 1 of 1 (latest)

harsh sonnet
#

I'm trying to generate a srcset with a 400px wide image. This Image component is not working to do that, I am only getting the original size. Any ideas why?

<img src="/_image?href=%2F%40fs%2FC%3A%2FUsers%2FAndrew%2FOneDrive%2FVSCode-to-go%2FWORK%2FDylanColeMusic%2Fsrc%2Fassets%2Fimages%2FIMG_20240222_232152.jpg%3ForigWidth%3D700%26origHeight%3D700%26origFormat%3Djpg&amp;f=webp" srcset="/_image?href=%2F%40fs%2FC%3A%2FUsers%2FAndrew%2FOneDrive%2FVSCode-to-go%2FWORK%2FDylanColeMusic%2Fsrc%2Fassets%2Fimages%2FIMG_20240222_232152.jpg%3ForigWidth%3D700%26origHeight%3D700%26origFormat%3Djpg&amp;w=400&amp;f=webp 400w, /_image?href=%2F%40fs%2FC%3A%2FUsers%2FAndrew%2FOneDrive%2FVSCode-to-go%2FWORK%2FDylanColeMusic%2Fsrc%2Fassets%2Fimages%2FIMG_20240222_232152.jpg%3ForigWidth%3D700%26origHeight%3D700%26origFormat%3Djpg&amp;f=webp 700w" alt="'Stuck in Calabasas' promotional image" sizes="(max-width: 500px) 400px" width="700" height="700" loading="lazy" decoding="async">
This is what I get back. It's two different urls for the srcset* but neither are 400px wide, both are full size.

robust hazelBOT
#

Hi @harsh sonnet. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Based on the knowledge sources provided, it seems that there have been issues reported with Astro's handling of image sizes and srcset attributes. For instance, one issue (https://github.com/withastro/astro/issues/8839) reported that the srcset attribute puts the largest image on the top of the list, causing the largest image to load all the time, regardless of the specified parameters. Another issue (https://github.com/withastro/astro/issues/8866) reported that Astro's Picture component generates unused images.

However, without more specific information about your Astro setup and the exact code you're using to generate the Image component, it's difficult to provide a definitive answer.

You might want to check if you're using the latest version of Astro and if your code aligns with the Astro documentation (https://astro.build/blog/astro-330#srcset-support) on using the srcset attribute.

If the problem persists, it might be worth raising an issue on the Astro GitHub page to get help from the Astro community.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: