<?php
session_start();
include 'config.php';

if (isset($_REQUEST['artic'])) {
//    $db = 'localhost:c:/sysplus/datos/pru/sysplus.fdb';
//    $dbusername = 'sysdba';
//    $dbpassword = 'MASTER123';
    $query = "SELECT ARTI_FOTO FROM ARTICULO WHERE ARTI_COD='".$_REQUEST['artic']."'";
    $dbh = ibase_connect($dbname, $dbuser, $dbpass, 'UTF8') or die('Could not connect DB');
    $result = ibase_query($query);    
    $data = ibase_fetch_object($result);
    if ($data)
    {
        header("Content-type: image/jpeg");
        ibase_blob_echo ($data->ARTI_FOTO);
    }
    ibase_close;
}
?>
