Reputation: 81
My image is not displaying in the browser and yet I seem to specify the correct url. What might be the problem? Here is the image tag:
<img src="C:/wamp/www/simple/images/greener.png" alt="Grass" width="400" height="400" />
It only displays the alternative text "Grass". Where could I be wrong? Help please.
Upvotes: 0
Views: 1379
Reputation: 13924
I assume that you're using apache webserver as part of a wamp stack. For security reasons most browsers don't allow http-pages to contain images with file-URLs so they just ignore them.
You should use a http-URL in your img-tag, not a file-URL.
Upvotes: 0
Reputation: 49188
That's a link to a file. It should instead point to a http://localhost...
or use the file:///
protocol.
http://localhost/simple/images/greener.png
(Note, I'm guessing C:/wamp/www/
is your webroot.)
Or:
file:///C:/wamp/www/simple/images/greener.png
Note, both of these only work if you are accessing a local file using a local server or local file using a local file. If you want others to get to it, you need to use a valid domain name available on your network or the internet at large.
Upvotes: 3