Subject | AW: AW: [firebird-php] Show a Jpg stored as Binary blob in a firebird table with PHP |
---|---|
Author | Gerhard Knapp |
Post date | 2003-06-26T08:46:53Z |
thank you very much Almond ...
the first time is see the images!!! :)
but now another problem exists: the images have errors,
wrong colors and so on ..., the resulting xxxx.jpg files
have this errors..., the images in the db are ok, i tested it
with IBExpert and delphi-application.
the size image.width and image.height is the right one, so i think the
image-header-information
is correct, but the data not ...
(my jpgs have the size: 512 x 384 pixel)
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:
header.
"<IMG SRC=\"image.php?id=999\">
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.
the first time is see the images!!! :)
but now another problem exists: the images have errors,
wrong colors and so on ..., the resulting xxxx.jpg files
have this errors..., the images in the db are ok, i tested it
with IBExpert and delphi-application.
the size image.width and image.height is the right one, so i think the
image-header-information
is correct, but the data not ...
(my jpgs have the size: 512 x 384 pixel)
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);Sorry, I use a sql lib.
> >if(empty($result)) echo SQL_error($f,$sst)."<BR>";
> >$tmprow=SQL_fetch_object($result,0);
>
>you mean ibase_fetch_object ??
> >$image = $tmprow->image;image/jpeg, it looks like IE6 can echo the picture w/o it.
> >header("Content-type: ".$tmprow->image_type);
>
>i have no imagetype stored in db, what is the value for image_type? "JPG"
>p.e.?
> >headers_sent();The above method is used by calling an external php, so, there is always a
>here comes the error, headers was sent before, sorry -..
>ibase_blob_echo($image);
header.
"<IMG SRC=\"image.php?id=999\">
>id doesn't work ...Yahoo! Groups Sponsor
>have an working example???
>
>thank you
>best regards
>-Gerhard
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.