From:             kaf at p dot pt
Operating system: Windows Server 2003
PHP version:      5.2.5
PHP Bug Type:     InterBase related
Bug description:  cannot insert image file blob_id in the table 

Description:
------------
When i try to import a TIF file to a BLOB colunn in a table with a BLOB
field subtype 1 in Firebird 2.0.2, always gives error.

Always gives the BLOB ID invalide when executes ibase_execute. But i
checked if the BLOB is well created using the ibase_blob_info and it is
okay.
Can you explain me why this does not work? 
I saw some other bugs reported in 2002 and 2003 (and the examples that
appear on the www.php.net for the ibase_blob_import) and nothing works in
my case. 
MY table is UTF 8.

Althought the Interbase manual refers that:
"
Blob is the InterBase datatype that represents various objects, such as
bitmapped images,
sound, video, and text. Before you store these items in the database, you
create or
manage them as platform- or product-specific files or data structures,
such as:
g TIFF, PICT, BMP, WMF, GEM, TARGA or other bitmapped or vector-graphic
files.
g MIDI or WAV sound files.
g Audio Video Interleaved format (.AVI) or QuickTime video files.
g ASCII, MIF, DOC, RTF, WPx or other text files.
g CAD files.
You must load these files from memory into the database programmatically,
as you do
any other host-language data items or records you intend to store in
InterBase.
"

I tried with a BMP instead of TIF and the problem remains.
I suspect this is a bug in php. Can you help me?

Reproduce code:
---------------
      $="1";
      $ficheiro="d:\\y\\" .$i. ".tif";
      $fd = fopen($ficheiro, 'rb');
      if ($fd) {
         $blob = ibase_blob_import($fd);
         fclose($fd);
            if (!is_string($blob)){
                echo "Falhou a conversacao em BLOB da imagem ".$i.".tif<br>";
                exit;
                }else{
                echo "BLOB ID da imagem (".$i.".tif): ".$blob."<br>";
                     }  
         $ta = ibase_trans($transacao_ops, $connection);
       $query = "update ARQUIVO_DIGITAL set IMAGEM=? where NUMERO=".$i;
         $prepared = ibase_prepare($ta, $query);
       if (!ibase_execute($prepared, $blob)) {
           // record insertion failed
                echo "Falhou a insercao da imagem na tabela ".$i.".tif<br>";
           ibase_rollback($ta);
           ibase_free_query($query);
           }else {
                       echo "Suceeso: ".$i."<br>";
                   ibase_commit($ta);
                   ibase_free_query($query);
                         }
        } else {
                        echo "Falhou a abertura do ficheiro ".$i.".tif<br>";
               }        


Actual result:
--------------
PHP Warning:  ibase_execute() [<a
href='function.ibase-execute'>function.ibase-execute</a>]: invalid BLOB ID 
in D:\lixo.php on line xx


-- 
Edit bug report at http://bugs.php.net/?id=43674&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=43674&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=43674&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=43674&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=43674&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=43674&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=43674&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=43674&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=43674&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=43674&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=43674&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=43674&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=43674&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=43674&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=43674&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=43674&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=43674&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=43674&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=43674&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=43674&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=43674&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=43674&r=mysqlcfg

Reply via email to