sudeep cv sudeep cv - 18 days ago 7
PHP Question

Display image using absolute path

I am using uploadify to upload img to server at the time of upload i saved absolute path to the data base its like:

/var/www/html/workbench/photogallery/uploads/logo2.jpg

now i want to display the same in browser the following method does not work

<div id="photos">
<h3>Photo title</h3>
<P class="like"><a href="#">Like</a> </P>
<p class="date">date </p>
<p class="pclear" />
<div id="image">
<img src="<?php echo $result_set['path']; ?>" />


// this doesn't work . when I edit the path manually to uploads/logo2.jpg work perfectly

about image goes here


how can I resolve this problem?

Answer

You need to use an url, not a path.

This:

/var/www/html/workbench/photogallery/uploads/logo2.jpg

is a physical path, the address on that server where the image is found. You need to use an url available for your visitors. I guess that you have a name mapped to that server (something like localhost or www.example.com).

From the structure I guess that your url would be something like

http://www.example.com/photogallery/uploads/logo2.jpg

where www.example.com is the base url you are using to get to that application