ponlo asi:
Código PHP:
<?php
header("Content-Type: image/jpeg");
$link = mysqli_connect($hostname,$user,$password,$database );
$query = "select foto from foto where id_foto= $_GET[id_foto] ";
$result = mysqli_query($link, $query);
/* associative array */
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)){
//echo "{$row['foto']}<br>\n";
echo "<img src=/"".$row['foto']."/" /><br>\n";
}
/* free result set */
mysqli_free_result($result);
/* close connection */
mysqli_close($link);
?>