PNG images not showing once deployed
Unanswered
Silky ant posted this in #help-forum
Silky antOP
So for some strange reason, my local PNG images are not being shown once I deploy my project. When I change the image to an SVG then it shows once I deploy. I haven't touched any code in my previous nextJS project and the photos aren't showing anymore as well.
49 Replies
Silky antOP
Okay I guess nobody can help me
Vercel sucks I can’t even get any type of support
Snowshoe
try adding a bit more detail. What does the html & logs show? Does it say image not found? Are they in the public folder?
Silky antOP
Yes they are in the public folder it was working then stopped working out of nowhere. I added more data to my GitHub I though that was the problem & automatically some images started showing up again on some of my sites. I think the issue is directly towards vercel. When I deployed the same project to netlify it was working perfectly fine
It doesn’t say image is not found it just shows a question mark in the little box
My html says Failed to load resources: the server responded with a status of 500()
My html shows the static image url but it’s not showing the actual image
@Silky ant when you go to the static url in the html, does the img load?
what's your folder structure
Silky antOP
@!=tgt only some images load & my structure is public/images
Everything is correctly done, it just stopped working out of nowhere
Everything is correctly done, it just stopped working out of nowhere
and try again
@!=tgt and try again
Silky antOP
I just did, it didnt do anything
@Silky ant I just did, it didnt do anything
try going to
localhost:3000/[an image]does it 404?
whats your directory structure?
Silky antOP
valentines-dwemo.vercel.app
That first heart lock image wasn’t showing up until I turned it into a svg
hm
ok
checkign
@Silky ant you're using pages router?
import handLove from '../public/images/hand_with_love.png';
import heart from '../public/images/hearlock1.svg';
import loveHeart from '../public/images/loveeee.svg';
import hotairballoon from '../public/images/airb.png';found the problem
Silky antOP
No for this project I’m using app router. Some of my previous projects are using the page router
@Silky ant Here’s one of my project that’s not working
https://github.com/dreayoung/valentines-dwemo
this doesnt' look like app router
@Silky ant 👀 👀
change to
import handLove from '/images/hand_with_love.png';
import heart from '/images/hearlock1.svg';
import loveHeart from '/images/loveeee.svg';
import hotairballoon from '/images/airb.png';@Silky ant Oh sorry this is pages router
never used it but I found a problem
Silky antOP
But the svg one works & it’s imported the first way, so why wouldn’t the others ?
use the import statelments I gave
you don't put
/public before an import statementSilky antOP
It failed as soon as I tried to deploy because of the changed import statement
& says module not found
When I deploy on netlify everything works… so maybe I just have an error with vercel
@!=tgt does it run locally
Silky antOP
everything works locally the way I had it… but once I deploy it’s not working
Nothing is wrong with my code
@Silky ant everything works locally the way I had it… but once I deploy it’s not working
seems like a vercel issue then
i have never used vercel
@Silky ant is there a github?
@!=tgt seems like a vercel issue then
Silky antOP
what do you use to deploy?
I updated my GitHub storage yesterday hoping that would fix the problem & it did a little
@Silky ant what do you use to deploy?
I tend to selfhost
just use
pm2 "npm run start" and then use cloudflare tunnels@!=tgt just use `pm2 "npm run start"` and then use cloudflare tunnels
Silky antOP
Never used cloudflare tunnels but I’ll look into it