
17 Mar
2010
17 Mar
'10
10:55 a.m.
hello scenario -------------- images stored as binary in sybase odbc-connection swali -------- how do i view the image in a browser? i have tried (almost) everything in vain. this is my code ------------------------ <?php function hex2bin($data){ $len = strlen($data); return pack("H" . $len, $data); } $connH=odbc_pconnect("myDB","me","mypassword") or die(odbc_errormsg()); $result=odbc_exec($connH, "select top 1 image from images where id='1'"); if ($result) { odbc_longreadlen($result, 131072); odbc_binmode($result,ODBC_BINMODE_CONVERT); $m_FValue=odbc_result($result, 1); header("Content-Type: image/jpeg"); echo $out=hex2bin($m_FValue); } ?>