Bug #44693 [NoF]: read blob; ibase_blob_echo: BLOB not found
Edit report at https://bugs.php.net/bug.php?id=44693&edit=1
ID: 44693
Updated by: requinix@php.net
Reported by: david at zegrange dot com
Summary: read blob; ibase_blob_echo: BLOB not found
Status: No Feedback
Type: Bug
Package: InterBase related
Operating System: Mandriva 2008.1
PHP Version: 5.2.5
Block user comment: N
Private report: N
New Comment:
@ffortuny:
This is not the place to get help with your code. Please take your questions to a mailing list or
online forum, where they will tell you about how you can't output HTML and image data at the
same time.
http://www.php.net/support.php
Previous Comments:
------------------------------------------------------------------------
[2014-02-11 03:48:20] ffortuny at gmail dot com
Here is the code:
function glGetPic2()
{
$sql = "select
a.id, a.descri, a.url, b.purpose, a.pic, a.mime
from glpics a
left outer join picpurps b on b.idpurp=a.idpurp
where a.iden = ".$_REQUEST["iden"]."
and a.idtabla = ".$_REQUEST["idtabla"];
$con = ibase_connect("glpics","sysdba","kliam56") or
die(ibase_errmsg()." No se pudo conectar a la base glpics");
$res = ibase_query($con,$sql);
while($dat = ibase_fetch_row($res))
{
echo "<div style='width:65%;margin:0 auto 0 auto;' >";
if(strlen($dat[2]) > 0)
{
// se trata de un URL
echo "<img style='width:90%;display:block;margin:0 auto 0 auto'
src=\"".$dat[2]."\" />";
}
else {
// se trata de un blob
/* $bi = ibase_blob_info($dat[4]);
$ln = $bi["length"];
$bo = ibase_blob_open($dat[4]);
$pblo = ibase_blob_get($bo,$ln);
ibase_blob_close($bo);
$fp =
fopen("/home/lazaro/public_html/img/glpic".$dat[0].".jpg","w");
fputs($fp,$pblo,$ln);
fclose($fp);
echo "<img style='width:90%;display:block;margin:0 auto 0 auto'
src='img/glpic".$dat[0].".jpg' >";*/
header("Content-Type: ".$dat[5]);
ibase_blob_echo($dat[4]);
}
echo
"<p>".$dat[1]." (".$dat[3].")</p></div>";
}
}
As I receive the data, it comes in the form of characters from the content of the blob. My text is
properly inserted. It is received through ajax, but the result in a direct URL is just as wrong,
except that it wants to save the page.
It definitely doesn't show the images. They're all jpg now.
------------------------------------------------------------------------
[2008-10-29 01:00:02] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2008-10-21 11:27:55] jani@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
------------------------------------------------------------------------
[2008-05-16 07:57:00] ale dot pas at tiscali dot it
Might be related with
http://bugs.php.net/bug.php?id=42266
this just adds a record to the long list of firebird blob related bugs introduced after 5.2.1
------------------------------------------------------------------------
[2008-04-11 09:38:24] david at zegrange dot com
Description:
------------
Hello. We were using PHP 5.1.6 (mandriva 2007) with not problem, then we ugraded to PHP 5.2.5
(mandriva 2008 or 2008.1) on new server and suddenly our BLOB fiels (is a small image) are not being
returned. I have verified that they still store properly in the Firebird 2.0 database. No problem
with the other functions.
If i downgrade back to PHP 5.1.6 (mandriva 2007) on new sever, the problem is fixed.
Other Interbase/Firebird functions are working well.
Thank's for your feeback.
Reproduce code:
---------------
The table in dbtest.fdb:
CREATE TABLE DF_ETAT (
ETAT_NO SMALLINT NOT NULL,
ICONE BLOB SUB_TYPE 0 SEGMENT SIZE 80,
);
The php file : test.php
<?
header('Content-type: image/png');
$dbi =
ibase_connect('db_server:/data/dbtest.fdb','SYSDBA','masterkey','NONE');
$sql = "SELECT ICONE FROM DF_ETAT WHERE ETAT_NO=20";
$sth = ibase_query($dbi,$sql);
$row = ibase_fetch_object($sth);
$blob = ibase_blob_echo($row->ICONE);
$ibase_close($dbi);
?>
Expected result:
----------------
I expected to see my BLOB fields on the web page test.php
Actual result:
--------------
I didn't see my BLOB fields.
Error log message for httpd return :
[error] [client 192.168.1.57] PHP Warning: ibase_blob_echo() [<a
href='function.ibase-blob-echo'>function.fbird-blob-echo</a>]: BLOB not found in
/var/www/html/test.php on line 6
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=44693&edit=1
Thread (5 messages)