2012-02-23 77 views
2

如何將博客圖像插入火鳥?火鳥上的斑點圖像

我已經使用ibexpert成功插入了它,但是當我從我的web應用程序訪問它時,它無法顯示。

爲什麼要解決這個問題?

+0

要插入或找回? – EMBarbosa 2012-03-29 02:10:48

回答

4

PHP樣品(PHP5,InterBase和PHP5-GD模塊所需)

 

require("db.php"); 
require("class.image.php"); 
header("Content-type: image/jpeg"); 

$db = db_connect(); 
$id_s = intval($_GET["id"]); 
$id=intval($id_s); 

// 
$q = ibase_query($db ,"select ITEMPICS_BODY from ITEMPICS where ITEMPICS_ID = $id"); 
$row=ibase_fetch_object($q); 
$blob_data = ibase_blob_info($row->ITEMPICS_BODY); 
$blob_hndl = ibase_blob_open($row->ITEMPICS_BODY); 
$bl = ibase_blob_get($blob_hndl, $blob_data[0]); 
ibase_free_result($q); 

$w = 640; $h = 640; 

$filename = $bl ? dirname(__FILE__)."/img/product__$id.jpg" : dirname(__FILE__)."/img/no_pic.jpg"; 

if ($bl) fwrite(fopen($filename, 'w'), $bl); 
$img = new Image($filename); 
$img->resize($w, $h, 1, 0); 
$img->toBrowser(); 

if ($bl) @unlink($filename);