Hi all. I'm having some trouble pulling an image which is stored in a BLOB from a postgresql db and displaying it in a browser.
Here's the code:
Header("Content-type: image/jpg");
pg_query($dbh, "BEGIN");
$ofp = pg_lo_open($data[2], "r");
if (!$ofp) {
echo "cannot open BLOB<br>\n";
}
$img = pg_lo_read_all($ofp);
print $img;
pg_lo_close($ofp);
pg_query($dbh, "END");
Now, as soon as the code starts I get prompted to download the php file.
Can anyone see what the problem is?
Thanks in advance,
Pablo