Reputation: 3
i'm trying to display an image using php to include its full path but the picture doesn't want to show up, the code i'm using is :
<img src="<?php echo $_SERVER['DOCUMENT_ROOT'] . 'Romeo/Yoomak/pix/Logo9.png';?>" width="200" height="200" alt="Logo"/>
No Error shows up in the output but the picture doesn't show up so what should i do ? help pls and thnx in advance.
That's what i get: image not showing up as shown in this SS
Upvotes: 0
Views: 104
Reputation: 943097
The Document Root is the directory on filesystem of the computer running the HTTP server that corresponds to the /
path in the server's URL.
The browser will ask the HTTP server for an HTTP URL.
The browser can't read files directory from the server's filesystem (it would be a dreadful security problem if it could).
Assuming that the file really is in that path from the document root, you should have simply:
<img src="/Romeo/Yoomak/pix/Logo9.png" width="200" height="200" alt="Logo"/>
NB: Logo is pretty dreadful alt text
Upvotes: 1
Reputation: 11
You need to add "/" before Romeo. Or you set an incorrect path here: 'Romeo/Yoomak/pix/Logo9.png'
Upvotes: 1