DEV Community

Cover image for Unable to Display Images on Your Server? Get in Here!
Cyprian
Cyprian

Posted on

Unable to Display Images on Your Server? Get in Here!

I don't know who has or is battling with displaying images on their local server either from the VScode Live extension or from a third party. I'm just dropping this to help anyone suffering from what i was struggle with for over a month untill last night.

After having posted my issues on several platforms and got tons of jargons that never helped me, and googling untill my brains were almost jumping off my head, i did it last night (might be morning or afternoon for you depending on your geography).

First of all, i realised the file path or extension plays an important role on how file elements behave. Sometimes because computers pop things easily for us we assume it's a very smart device, and then when it fails to execute what we consider easy programs, we become extremely frustrated forgetting that computers are just programmed to think and act within the parameters of the instructions given to them.

Forgive me, let's roll. Now from my experience i realised servers can only access files from themselves, I mean the root of the server and not from anywhere else. So a localhost in xammp can only access files culminating from it's root, same with the VScode extension.

If all that is confusing let me just drop how i solved my issue. Get the pictures in the same folder with other files you're using for the project. edit them with just a simple name and all lowercase, and then add that name into your project. never use the full path as this might go beyond the scope of how much length the server needs to access a file.

Happy coding ❤️

Discussion (0)