Home > Net >  Add image in html with full path
Add image in html with full path

Time:09-19

I try to add image in html with full path. I google the problem and found this enter image description here

  1. click right-click on the image in the file explorer
    you will see a dropdown with some buttons

  2. click the "copy path"

enter image description here

  1. now we need to add the link to the src attribute

  2. write file:/// (3 slash /)

  3. paste the copied path after file:///

file:///"C:\Users\laaou\Downloads\1280px-Stack_Overflow_logo.svg.png"
  1. delete the " character at the start and at the end "
file:///C:\Users\laaou\Downloads\1280px-Stack_Overflow_logo.svg.png
  1. like he said @mplungjan change the \ to / (see his first comment)

you can use an online tool like this http://www.unit-conversion.info/texttools/replace-text/ (if you have long links)

  1. here is the final HTML
<img src="file:///C:/Users/laaou/Downloads/1280px-Stack_Overflow_logo.svg.png">

alternative ways

but still better to put the images in the same folder where there is the index.html

so you just need to write

  1. ./imageName.png
  2. or ./MyFolder/imageName.png

or host your image in a service like Imgur

and write that link inside the src

the link it will be like this: https://i.stack.imgur.com/PRUS3.png

<img src="https://i.stack.imgur.com/PRUS3.png">
  • Related