user-707
user-707

Reputation: 1

HTML/CSS: display images from linux localhost(firefox)

How can i display images from localhost in a simple html page, in firefox web browser ?

"file:///home/xuser/work/helico.jpeg" doesn't work.

Upvotes: 0

Views: 3007

Answers (2)

Yoan
Yoan

Reputation: 46

If you are running it in linux and it is hosted locally, we assume that your project is in var/www/html.

So if you want to access /home/xuser/work/helico.jpeg, you need to move up 4 times before reaching the home/ folder.

To move up, use ../ at the beginning of your path. And since you need to move up 4 times, use it four times before the /home/xuser/work/helico.jpeg.

Your link or path should be ../../../../home/xuser/work/helico.jpeg

Try this one. This may or may not work.

Upvotes: 0

Oke Tega
Oke Tega

Reputation: 883

It would be easier of you put the images In your root folder since you are going to be working with localhost

<img src="img/pic.png">

But if you would like to get the image from your systems localhost that is somewhere outside root folder it can be pretty stressful at time as you might need to know the image path and might also need to go back a couple of folders. Something like this depending on your image path

  <img src="../../../../../../../../../image/pic.png">

So it is good you put the image in you root folder for easy access.

Upvotes: 1

Related Questions