Subject AW: AW: [firebird-php] Show a Jpg stored as Binary blob in a firebird table with PHP
Author Gerhard Knapp
the original filesize was: 49.4 kb
the extracted blob jpg.file has now: 771 kb
????
very dubios ...

best regards
-Gerhard

-----Ursprungliche Nachricht-----
Von: Almond [mailto:almond@...]
Gesendet: Donnerstag, 26. Juni 2003 07:09
An: firebird-php@yahoogroups.com
Betreff: Re: AW: [firebird-php] Show a Jpg stored as Binary blob in a
firebird table with PHP


The following is the combination of other people's work. It works on my
machine.

<?php
error_reporting(E_ALL);
$db = '/data/html/phpgem312/test.gdb';
$user = 'sysdba';
$password = 'masterkey';
$conn=@ibase_pconnect($host.":".$db,$user,$password);M

$S = "select images_id, image from images_tbl";
$S .= " where images_id > '0'";

$Q = ibase_query($S);
while ($R = ibase_fetch_object($Q))
{
$TEMPFILE = tempnam("./","TMP");
$TEMPFILE .= ".jpg";

$BLOBID = ibase_blob_open($R->IMAGE);
$FILEID = fopen($TEMPFILE,"w");

//Loop thru the blob, fetching 10K chunks, and write it to the temp file
while ($PIC = ibase_blob_get($BLOBID,10240))
{
fputs($FILEID,$PIC);
}
fclose($FILEID);
ibase_blob_close($BLOBID);
echo "<BR><BR><CENTER><IMG SRC=$TEMPFILE ></CENTER>";
}
ibase_free_result($Q);
ibase_commit();
?>

At 16:54 03/06/25 +0200, you wrote:
> >$sst = "SELECT image, image_type FROM images_tbl WHERE images_id='123''
";
> >$result = ibase_query($sst, $f);
> >if(empty($result)) echo SQL_error($f,$sst)."<BR>";
> >$tmprow=SQL_fetch_object($result,0);
>
>you mean ibase_fetch_object ??
Sorry, I use a sql lib.

> >$image = $tmprow->image;
> >header("Content-type: ".$tmprow->image_type);
>
>i have no imagetype stored in db, what is the value for image_type? "JPG"
>p.e.?

image/jpeg, it looks like IE6 can echo the picture w/o it.

> >headers_sent();
>here comes the error, headers was sent before, sorry -..
>ibase_blob_echo($image);

The above method is used by calling an external php, so, there is always a
header.
"<IMG SRC=\"image.php?id=999\">


>id doesn't work ...
>have an working example???
>
>thank you
>best regards
>-Gerhard


Yahoo! Groups Sponsor
ADVERTISEMENT




To unsubscribe from this group, send an email to:
firebird-php-unsubscribe@yahoogroups.com



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.