Image component fails when using image data URI
See original GitHub issueBug report
Describe the bug
When passing an image data URI to the Next.js image component an error is thrown.
To Reproduce
Pass data URI to the Next.js image component:
Example:
import Image from 'next/image';
<Image src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=">
Expected behavior
The simplest solution and expectation would be to pass the URI directly to the img
tag without any modification or optimization.
Screenshots
Not applicable but error reported on the debug overlay is:
Error: Invalid src prop (data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=) on `next/image`, hostname is not configured under images in your `next.config.js`
System information
- OS: Windows
- Browser (if applies) Chrome, Firefox, Edge
- Version of Next.js: 10.0.0
- Version of Node.js: 12.9.0
Additional context
None.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:21
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Unable to load image from data Uri - android - Stack Overflow
I am receiving a data uri from a remote API using retrofit. I tried many methods yet not able to get the image...
Read more >Is data URI in <img> tag not supported? - Meta Stack Exchange
Tried it out in the sandbox, and it looks like data URI doesn't work with PNG either. This is what I tried so...
Read more >data URI scheme - Wikipedia
The data URI scheme is a uniform resource identifier (URI) scheme that provides a way to ... This technique allows normally separate elements...
Read more >HTMLCanvasElement.toDataURL() - Web APIs | MDN
toDataURL() method returns a data URL containing a representation of the image in the format specified by the type parameter.
Read more >datauri - npm
The data URI scheme is a uniform resource identifier (URI) scheme that provides a way to include data in-line in web pages as...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
<Image src="" ...
For me it worked writing like this on Next.js v11.0.1:
<Image unoptimized src={
data:image/jpeg;base64,${imageBase64}} alt="Landscape picture" width={300} height={300} />