PDA

View Full Version : How do you display an image file ?


songboy
01-09-2010, 11:44 PM
Hi - I have managed to save a photo in a folder and I have managed to save the address and name of this image in a mysql table using php. Now I am at the stage where I need to pull the image out of the folder so that it is displayed on a web page. I can get the pathway and name information out of my database. I can even echo this data in the div on the web page - obviously not useful because it is the just the pathway/name text.
Could someone explain/show how the pathway/name data is used to fetch the image from the folder and place it on the web page ?
This code accesses the pathway/name data from the mysql table:

$query = sprintf("SELECT photo_file FROM writer_photo WHERE writer_id = '$writer_id' ");
@$resultphoto = mysqli_query($cxn, $query) or die ("Could not execute query7.");
@$row = mysqli_fetch_array($resultphoto);
@$photo_file = $row['photo_file'];

$_SESSION['photo_file']= @$photo_file;

So, I've got the file name etc. How do you get the photo from the stored folder onto the viewer web page ?
Happy New Year !
Songboy

edbr
01-10-2010, 02:31 AM
<img src="image_folder/<?php echo$row['photo_file'];?>" > i would think or have i missed the point ?