2012-02-23 79 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);