ID: 43674 User updated by: kaf at p dot pt Reported By: kaf at p dot pt Status: Open Bug Type: InterBase related Operating System: Windows Server 2003 PHP Version: 5.2.5 New Comment:
The field in table is BLOB subtype 0. Not 1. Previous Comments: ------------------------------------------------------------------------ [2007-12-25 16:09:23] kaf at p dot pt 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 this bug report at http://bugs.php.net/?id=43674&edit=1