ibase_blob_echo

(PHP 5)

ibase_blob_echo Visualizza il contenuto di un blob sul browser

Descrizione

bool ibase_blob_echo ( string $blob_id )

Questa funzione apre un BLOB in lettura ed invia il suo contenuto direttamente allo standard output (prevalentemente il browser). Restituisce TRUE in caso di successo, FALSE in caso di fallimento.

Vedere anche ibase_blob_open(), ibase_blob_close() e ibase_blob_get().

add a note add a note

User Contributed Notes 2 notes

up
1
jure dot sah at monoliths dot com
10 days ago
There is an alternative for getting text out of a blob that does not require as much code. Quoted from a handy online resource:

PHP offers natively the possibility of getting the BLOB data as a string.

For example ibase_fetch_assoc ( resource $result [, int $fetch_flag = 0 ] ) provides the $fetch_flag parameter which can be set to IBASE_TEXT, causing the function to return BLOB contents instead of BLOB ids.
up
-3
int21h
4 years ago
here is an example if image.php

<?php
if (isset($_REQUEST['imageid']) AND $_REQUEST['imageid']>0) {
   
$db = 'host:/var/db/mydb.fdb';
   
$dbusername = 'sysdba';
   
$dbpassword = 'masterkey';
   
$query = "SELECT IMAGEDATA, MIME FROM IMAGES WHERE IMAGEID=".$_REQUEST['imageid'];
   
$dbh = ibase_connect($db, $dbusername, $dbpassword, 'UTF8') or die('Couldn't connect DB');
    $result = ibase_query($query);   
    $data = ibase_fetch_object($result);
    if ($data)
    {
        header("Content-type: ".$data->MIME);
        ibase_blob_echo ($data->IMAGEDATA);
    }
    ibase_close($dbh);
}
?>
To Top