View images from a BLOB field of a Firebird database in PHP

Asked

Viewed 223 times

0

I think someone will feel entitled to say that this question is a duplicate, but I disagree, there is a question that answers in a simple and objective way a method of displaying an image of a field blob in PHP, using Firebird.

For what I was able to gather on the internet. This code seems correct.

if($db = ibase_connect('C:\Banco.FDB', 'sysdba', 'masterkey')){
    $result = ibase_query($db, 'SELECT IMAGEM FROM PRODUTO_GALERIA where id = 478');
    while ($row = ibase_fetch_object($result)) {
       header("Content-type: image/jpeg");
       echo $row->IMAGEM;
    }
    }

A simple query in one of my tables that brings an image as a result (with id 478), but the result is not an image but a small square in the middle of the screen. I tried all methods I found on the internet and only got compilation errors and this little square on the screen.

inserir a descrição da imagem aqui

  • Removing the header, appears any error message? Already tested with other data?

  • Which I remember when removing the header a hexadecimal.code appears and I tested all the images and gives the same result

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.