I am attempting to recall an image from the database. I have established the image reaches the database properly, however when I pull the image down I get the Blob text that makes it up. How can I pull down the image in order to display the image?
<?php
//libs
include 'library/config.php';
include 'library/opendb.php';
//query
$query = "SELECT * FROM `upload` WHERE `postID`=".$elem["postID"].";";
$result = mysqli_query($conn, $query);
if (mysqli_num_rows($result) > 0) { // if results exist
while ($row = mysqli_fetch_assoc($result)) { // assign db cont to variable
$name = $row["name"];
$size = $row["size"];
$type = $row["type"];
$content = $row["content"];
// header info
header("Content-length: $size");
header("Content-type: $type");
header("Content-Disposition: attachment; filename=$name");
//display image
echo "img", $content;
}
include 'library/closedb.php';
?>