Local Images not Stored in Public Folder?
Answered
Cuvier’s Dwarf Caiman posted this in #help-forum
Cuvier’s Dwarf CaimanOP
How do you import an image stored on your computer that is not in the public folder. I get:
Error: Invalid src prop (C:\Users\...) onnext/image, hostname "" is not configured under images in yournext.config.jsSee more info: https://nextjs.org/docs/messages/next-image-unconfigured-hostAnswered by joulev
instead of
use
;<Image src="C:\\Users\\..." />use
import image from "../image.png";
<Image src={image} />2 Replies
@Cuvier’s Dwarf Caiman How do you import an image stored on your computer that is not in the public folder. I get:
`Error: Invalid src prop (C:\Users\...) on `next/image`, hostname "" is not configured under images in your `next.config.js`
See more info: https://nextjs.org/docs/messages/next-image-unconfigured-host`
instead of
use
;<Image src="C:\\Users\\..." />use
import image from "../image.png";
<Image src={image} />Answer
@joulev instead of
tsx
;<Image src="C:\\Users\\..." />
use
tsx
import image from "../image.png";
<Image src={image} />
Cuvier’s Dwarf CaimanOP
Thank you for your help! It solved it.