$query = "select resim from tabloadi where id=bilmemne";
$get = mssql_query($query);
$row = mssql_fetch_assoc($get);
$image = $row['resim'];
function hex2bin($h)
{
if (!is_string($h)) return null;
$r='';
for ($a=0; $a<strlen($h); $a+=2) { $r.=chr(hexdec($h{$a}.$h{($a+1)})); }
return $r;
}
$image = hex2bin($image);
header("Content-type: image/gif");
print $image;
exit;