I'm trying to migrate to using WebP images on our website.
We have quite a few images in our S3 buckets, so it would take a while to convert all of them to webp. Instead, I'd like to show webp only if the webp version is available (it'll have a deterministic URL structure); and if not, show the original JPG/PNG.
When I try the following, it doesn't work (don't worry the icons on the top right. also webpImageUrl
and originalImageUrl
have the correct values):
<picture>
<source srcSet={`${webpImageUrl}`} type="image/webp" />
<img src={`${originalImageUrl}`} />
</picture>
Thanks in advance!