Reputation: 131
I'm trying to to display image (.jpg) file from the local storage in the browser. Any attempts to load jpg file do not produce any result. While using
<video width="620" height="640" controls="controls">
<source src="file:///Users/..../small.mp4" type="video/mp4">
I can access any mp4 file on my local drive and it's shown in the browser as expected. Is the way to access image (.jpg) files from the local storage the same way? Thanks
Upvotes: 1
Views: 12075
Reputation: 470
First off, I wouldn't suggest putting locally-stored files on the web, as your machine could get corrupted. Use something like GitHub pages or something to that effect to host all of your files in the cloud.
To answer your question, use
<img src="file:///path/to/your/image" alt="Image alternate text" style="height:100px;width:100px">
Your issue was most likely because you didn't have alt text in the <img>
tag, as this is required by the browser.
Upvotes: 0
Reputation: 43
for an image in html you need an image tag
<img src="file:///whatever">
Upvotes: 1
Reputation: 25
If you want to display images on your page the code should be similar to this:
<img src="picture.jpg" alt="My Picture" width="300" height="200">
Upvotes: 1