Static image is not loading
Answered
Baldfaced hornet posted this in #help-forum
Baldfaced hornetOP
<Link href="/">
<Image
src="/logo.png"
width={115}
height={43}
alt="Reef Trader"
/>
</Link>Answered by riský
The /public directory should remain in the root of your project.
https://nextjs.org/docs/app/building-your-application/configuring/src-directory
30 Replies
@Baldfaced hornet
<Link href="/">
<Image
src="/logo.png"
width={115}
height={43}
alt="Reef Trader"
/>
</Link>
does
logo.png exist in the root of the public folder? as the html could be from a 404 page.@riský does `logo.png` exist in the root of the public folder? as the html could be from a 404 page.
Baldfaced hornetOP
Yes, I included a picture of the file structure up above
and if you manually go to logo.png, is there an error that is displayed
or just when imported
Baldfaced hornetOP
Only when imported
i mean in test in browser
Baldfaced hornetOP
Would that just be port/logo.png? 404
do you have basepaths enabled?
as next/image doesn't respect them ðŸ˜
and otherwise, why ere you /logo.png in code nut port/logo.png there?
Baldfaced hornetOP
I do not have basepaths enabled
so why did you mention
port then?Baldfaced hornetOP
localhost:3000 is the test url in browser
So I was asking if to test for the image in browser if I would type "localhost:3000/logo.png"
ohh yeah
Baldfaced hornetOP
yeah returns a 404
and you are sure that the file is in the public folder and nothing else (and in the first layer, not any sub paths)
Baldfaced hornetOP
and do those other public files work?
ahh that doesn't matter because:
The /public directory should remain in the root of your project.
https://nextjs.org/docs/app/building-your-application/configuring/src-directory
Answer
Baldfaced hornetOP
the other files are not working
move the public folder to the same folder as next.config.js
and it should work
Baldfaced hornetOP
Working 🙂
Thank you for your help
Original message was deleted
@Baldfaced hornet can you mark it as solved, so to tell others you have fixed this issue 🙂
you have to use the command, as the image shows