I want to display images from mysql databse. I have made a table with filepath stored in it. Here's the php code. All I see is broken images, I can view images by right click-> View Image, but not otherwise.
<?php
require_once ('../mysql_connect.php'); // Connect to the db.
$query = "SELECT * FROM pictures";
$result = mysql_query($query)or die(mysql_error());
$num_results = mysql_num_rows($result);
echo '<P><strong>Number of items found: '.$num_results.'</strong></p>';
for ($i=0; $i <$num_results; $i++){
$row = mysql_fetch_array($result);
echo stripslashes($row[picture_id]);
$image = ($row[file_path]);
$dispimage = "<img src='$image'>";
echo $dispimage;
}//end of for loop
?>
I also tried saving images as longblob, but I see weird huge long text in the output. 😕