I saved an image in the BD in a field type BLOB but at the time of displaying it does not display the image, instead it leaves the screen black with a white square in the middle follows the code:
<?php
$query = mysqli_query($link, "select * from imagem");
while($row = mysqli_fetch_array($query)){
header('Content-Type: image/jpeg');
echo '<img src="renderiza.php?id="' . $row["id"] . '"/>';
}
?>
file renderiza.php
<?php
$link = mysqli_connect("localhost", "root", "", "teste");
$uid = $_GET["id"];
$query = mysqli_query($link, "select * from imagem WHERE id = '$uid'");
$image = mysqli_fetch_array($query);
$foto = $image['foto'];
header('Content-Type: image/jpeg');
echo $image['foto'];
?>