View display image BLOB with PHP/ORACLE!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
elyssonraphael
Forum Newbie
Posts: 1
Joined: Tue Dec 23, 2014 9:33 am

View display image BLOB with PHP/ORACLE!

Post by elyssonraphael »

I using..

Code: Select all

$consulta = oci_parse($conexao,"select photo from userp where usrph_status = 'A' and id = :didbv");
$didbv = $_POST["id"];
 
oci_bind_by_name($consulta, ':didbv', $didbv);
oci_execute($consulta, OCI_NO_AUTO_COMMIT);
while (($row = oci_fetch_array($consulta, OCI_ASSOC)) != false) {
 
$arr = oci_fetch_assoc($consulta);
header("Content-type: image/JPEG");
$result = $arr['PHOTO']->load();
 
print "<img src='".$arr['PHOTO']."'>";
print $result;
echo $result;
 
}


What appears in the result page is:

This image contains errors and can not be displayed.

How to fix this?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: View display image BLOB with PHP/ORACLE!

Post by requinix »

If you're outputting an image then don't put any HTML in it. If the PHOTO is a file then you have to dump the contents of the file (like with readfile) and if it's raw image data, which is the case here, then you simply output it.
Post Reply