I am trying to create a page where people can upload a picture for everyone to view.
I am trying to store the pictures in a directory and reference the file name via a MySQL table.
The uploading I have managed to sort, it stores the file where I want and adds the file name to the table.
It's viewing the image I am having trouble with. The page just shows a blank space where the pic should be but displays the rest of the info from the table correctly, i.e. who uploaded it and when.
Here is my code:
$myObject = new convertToAgo;
//var for gallery output
$returnstr = "";
$sql = mysql_query("SELECT * FROM pictures ORDER BY creation_date DESC");
while($row = mysql_fetch_array($sql)){
$username = $row["creator_name"];
$date = $row["creation_date"];
$file = $row["file_name"];
$convertedTime = ($myObject -> convert_datetime($date));
$whenAdded = ($myObject -> makeAgo($convertedTime));
$picture = "pictures/$file";
$returnstr .='<img src =\"$picture\" width="400px" height="400px" border="1px" />
<div class="response_top_div">Added by: ' . $username . ' | ' . $whenAdded . ' </div> <br/><br/><br/>';
}