Jump to content

View display image BLOB with PHP/ORACLE!


elyssonraphael

Recommended Posts

I using..

 

 

$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?

Link to comment
Share on other sites

You have several errors here.

 

1 - you are sending out that header line for EVERY record you retrieve in your query.  Bad.

 

2 - you begin your process loop by fetching an array.  Then your next statement you fetch another (assoc) array.  You're losing the first row

 

3 - where does that error message come from?  I don't see it in your code.  

 

Turn on php error checking (see my sign) and see if you get any errors.

 

Also - you echo out an img tag to display your image, so what is the following print statement supposed to do?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.