In my Database, the images(jpeg,bmp format) are stored in bytea datatype, showing up in binary code in the database. Now I want to retrieve the images from the database. But i could not get the image in the web page. When i retrieve using this code given below, it shows the binary code value.(ie combination of numbers,characters,symbols). My code was
$dbconn = pg_connect("host=localhost user=xxxx password=xxxx dbname=xxxx")
or die('Could not connect: ' .pg_last_error());
$rs = pg_query($dbconn, "select scan_image from image where cno='4' and imageno='1'");
$image = pg_escape_bytea(pg_fetch_result($rs, 0));
echo $image;
Am i correct with this code? Please help me to find the solution.