Hi,
I am trying to display an image on the browser by fetching blob object data from mysql database, I am getting the binary data, the proble is it is not displaying as an image when i try to bind it as source of html img control. It is only showing a box with cross mark. Any help on this is highly appriciated.
Here is my code
hello.php
<html>
<head>
<style type="text/css">
.background { background-image:url(back.png);background-repeat:repeat-x; }
</style>
<title>PHP Test</title>
</head>
<body>
<div Class="background">
<table style="width:100%; height:100px;">
<tr>
<td width="100%" align="center" height="100px">
<!-- Banner -->
My Page
</td>
</tr>
</table>
<table style="width:100%; height:100px;">
<tr>
<td>
<img src="getImage.php" height="80" width="60" />
</td >
<td width="30%" style="height:100px;">
<!-- Image2 -->
</td>
<td width="30%" style="height:100px;">
<!-- Image3 -->
image 3
</td>
</tr>
</table>
</div>
</body>
</html>
and getImage.php
<?php
mysql_connect("localhost:3308","user","pass") or die("Unable to connect to SQL server");
@mysql_select_db("dbwebcontents") or die("Unable to select database");
$result=mysql_query("select content_image from tblpagecontents where rowid=1") or die("Can't perform Query");
//$data=@MYSQL_RESULT($result,0,"content_image");
$data = mysql_fetch_array($result);
//header('Content-Length: '.strlen($data));
header('Content-type: image/jpg');
//header('Content-Disposition: inline; filename="add1.jpg"');
echo($data);
?>