从Oracle数据库中检索hugeblob图像给出了recorse id,PHP,Codeigniter

I am retrieving HUGEBLOB image from oracle database Using Codeigniter. When i Get the Image it gives Resource id #45.

My question is,

Why resource id is given? How to convert Recourse to string and display this image?

my code is,

public function get_image()
{
    $reg = $this->session->userdata['user'][0]['REG#'];
    /*$this->db->select("PIC");
    $query = $this->db->get_where("ADM_STUDENT",array("REG#" => "BET-FA07-012"));*/

    $query = $this->db->query("select * from ADM_STUDENT WHERE REG# = 'BEE-FA15-066'");
    $row = $query->row_array();
    echo "<pre>";
    print_r($row);
    //$this->output->set_header('content-type: image/jpeg');
    //print $row['PIC'];
    //echo '<img src="data:image/jpeg;base64,'.base64_encode( $row['PIC'] ).'"/>';
}

Please help me i am stuck on here.

Refer to the PDO documentation on handling LOBS:

PDO allows you to work with this large data type by using the PDO::PARAM_LOB type code in your PDOStatement::bindParam() or PDOStatement::bindColumn() calls. PDO::PARAM_LOB tells PDO to map the data as a stream, so that you can manipulate it using the PHP Streams API.

Example 1 shows 'Displaying an image from a database':

$db = new PDO('odbc:SAMPLE', 'db2inst1', 'ibmdb2');
$stmt = $db->prepare("select contenttype, imagedata from images where id=?");
$stmt->execute(array($_GET['id']));
$stmt->bindColumn(1, $type, PDO::PARAM_STR, 256);
$stmt->bindColumn(2, $lob, PDO::PARAM_LOB);
$stmt->fetch(PDO::FETCH_BOUND);

header("Content-Type: $type");
fpassthru($lob);

You'll probably need to cross-reference with the CodeIgniter documentation if the objects used in your code are part of that framework.

If the returned resource is of type stream (as in the example code) then you might be able to just use stream_get_contents like so:

$this->output->set_header('content-type: image/jpeg');
echo stream_get_contents($row['PIC']);