I am using smarty, mysql and I am just trying to display image. This is the error i am getting -
Resource interpreted as Image but transferred with MIME type text/html
My index.php file
<img src="http://localhost/admin/image2.php?id={$editWine[0].id}" width="150" height="260" border="0" class="bottle-img" id="smallImageWineEdit" />
My image2.php file
$id=$_REQUEST['id'];
$sql="SELECT * FROM table WHERE id=$id";
$result=mysql_query($sql) or die(mysql_error());
while($row=@mysql_fetch_assoc($result))
{
echo '<img src="data:image/jpeg;base64,'.base64_encode( $row['image_data'] ).'" width="150" height="150" />  ';
echo $row['image_data'];
}
This echo inside while loop is working fine.
And when i inspect element and open this img link in new tab, Image is displaying. whereas its not displaying in current page.
<img>tags in index.php and as output of image2.php?<img>tag from index.php expects content-type to be image, but you are sending back from image2.php html code with list of<img>tags with data-uris and not content-type image and image's binary code.