Hi
I have a problem and hope you can help me
I need to insert an image into the Interbase (BLOB SUB_TYPE 0 SEGMENT SIZE 800)
and afterwards to be able to extract it someware on my web page, but I still can not extract it right
This works but it displays only the image
<?PHP
include("sysvars.php");
$id = 108;
$dbh = ibase_pconnect($hostweb, $username, $password);
$sth = ibase_query($dbh, 'SELECT IMAGE FROM "BROSHURI" WHERE ID=' . $id);
//echo "<br>TEST<br>";
while($row = ibase_fetch_object($sth))
{
ibase_blob_echo($row->IMAGE);
}
?>
If I uncomment the //echo "<br>TEST<br>";
than the image is gone and disppalyed like : BM6@6(U@@3—›3—›3—›3—›3—›3—›3—›3—›3—›3—›3—›3—›3—›3—›3—›/љ˜) ˜1« ‘„(њЏ0 ”$˜‹/Ёљ˜‰џ”!§›џ˜ђЊ:ЎЈDџ¤5Ђ‰YљўV“—4pp%ccO“’FЋЋSЎ C–—<””......................................
I insert it like :
............
$fd2 = fopen ($image, "rb");
$bloby2 = ibase_blob_import($fd2);
.......
I presumed that the headers were the problem but I tried some things and still nothing
Can some one please help me ?
Thanks
Problem extracting BLOB from Interbase !
Moderator: General Moderators
-
fractalvibes
- Forum Contributor
- Posts: 335
- Joined: Thu Sep 26, 2002 6:14 pm
- Location: Waco, Texas
You need to send a header to set the content-type to the type of object you want to display. Note, you cannot send both text/html and the image from the same page. Create a separate page to server up the BLOB and where you want your image displayed do something like:
<img src='ShowImage.php?ID=108'>
ShowImage.php will set it's content type to image/jpg or whatever and stream to the browser.
Phil
<img src='ShowImage.php?ID=108'>
ShowImage.php will set it's content type to image/jpg or whatever and stream to the browser.
Phil