Subject | Re: [firebird-php] Problem in retrieving BLOB data |
---|---|
Author | Lester Caine |
Post date | 2009-06-01T06:56:26Z |
bala_karat wrote:
than the blob size you will get a truncated result
Option 1 ... ibase_fetch_object($result, IBASE_TEXT);
This will return the text of the blob rather than the blob ID
Option 2 ... read the stream provided by $blob_hndl into a string
Grab a copy of ADOdb and check out the _BlobDecode()
(
http://www.mantisforge.org/dev/phpxref/core/adodb/drivers/adodb-ibase.inc.php.source.html#l571
will give you an on-line version to look at ... note the inclusion of
the connection resource for PHP5! )
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
> Hi !Actually that is working correctly ... but if $blob_data[0] is greater
>
> Any problem in retriving blob data? I have been trying different combinations with no success.
>
> For the following combination, I get the data echoed as "BINARY"
>
> $host = "localhost:C:/BK_Share/file_test/FILE.FDB";
> ibase_connect($host, "SYSDBA", "masterkey");
> $result = ibase_query("select TEST from EMPLOYEEMASTER where EMPCODE = '002'");
> $data = ibase_fetch_object($result);
> $blob_data = ibase_blob_info($data->TEST);
> $blob_hndl = ibase_blob_open($data->TEST);
> echo ibase_blob_get($blob_hndl,$blob_data[0]);
>
> The blob data is created manually - a text string. The ultimate requirement is to read pdf files stored in blob fields.
>
> Using Apache 2.2.11(Win 32) and PHP 5.2.9-1
than the blob size you will get a truncated result
Option 1 ... ibase_fetch_object($result, IBASE_TEXT);
This will return the text of the blob rather than the blob ID
Option 2 ... read the stream provided by $blob_hndl into a string
Grab a copy of ADOdb and check out the _BlobDecode()
(
http://www.mantisforge.org/dev/phpxref/core/adodb/drivers/adodb-ibase.inc.php.source.html#l571
will give you an on-line version to look at ... note the inclusion of
the connection resource for PHP5! )
--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php