-
Hey 👋 We get an optimized image back from our API and want to use next/image to display it. We would like to show Webp and the allow it to fallback to jpg in unsupported browsers. From what I can see this is not currently possible. Example
Ideally we could do something like:
Is it currently possible to do anything like this? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
If you use unoptimized it will behave like the You can have the behavior you want with a default <img src="/path/to/broken/image" onError={(e) => (e.target.onerror = null, e.target.src = '/fallback/image.jpg')}/> Hope this helps your problem for now, until they consider adding this behaviour by default. |
Beta Was this translation helpful? Give feedback.
-
This has been fixed in #35190 Please give it a try with |
Beta Was this translation helpful? Give feedback.
This has been fixed in #35190
Please give it a try with
npm i next@canary
oryarn add next@canary
, thanks!