I can not display an image that is saved in the BLOB database

0

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'];

?>
    
asked by anonymous 22.07.2017 / 01:07

0 answers