0

I am trying to add an image from my downloads in my Mac Finder (using HTML) but the image won't show up when I've tried.

I opened the image with Chrome to get a link: Users/oliviamartin/Downloads/flatweb.jpg

And formatted it like this:

<img src="file:///Users/oliviamartin/Downloads/flatweb.jpg" class="img-fluid" alt="Responsive image">

But no image appears after putting into the code.

Any help would be appreciated!

<img src="file:///Users/oliviamartin/Downloads/flatweb.jpg" class="img-fluid" alt="Responsive image">
4
  • Not sure why the code isn't showing up: here it is <img src="file:///Users/oliviamartin/Downloads/flatweb.jpg" class="img-fluid" alt="Responsive image"> Commented Mar 25, 2023 at 19:17
  • Are you serving the HTML in which you’ve included this markup with a proper HTTP server? If so, your browser will disallow file:/// links as it would otherwise represent a very large security risk if any arbitrary website could read files from your filesystem. Commented Mar 25, 2023 at 19:20
  • Who else do you expect to be viewing the HTML page? They are unlikely to have a /Users/oliviamartin folder on their computers, And even less likely to have a Downloads/flatweb.jpg file therein if they somehow do. Commented Mar 25, 2023 at 19:26
  • I tried on my Mac and it works. The question is: how do you open the HTML file? You just "throw" it to the navigator window? You use the web server on the Mac? You put this HTML on a web server? Commented Mar 25, 2023 at 19:26

1 Answer 1

0

If you are hosting this HTML page on a local server (which I believe you are) then place your image within that directory Users/oliviamartin/documents/github/project/imgs/flatweb.jpg. You can then serve that image from the directory with a relative url /imgs/flatweb.jpg.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.