[url]http://labs.iamkoa.net/2007/10/23/image-upload-component-cakephp/[/url]
[url]http://www.jamesfairhurst.co.uk/posts/view/uploading_files_and_images_with_cakephp[/url]
[url]http://bakery.cakephp.org/articles/view/file-upload-component-w-automagic-model-optional[/url]
[url]http://junnan.org/blog/?p=270[/url]
将图片从数据库中读出并显示
一、后台
function downloadimg()
{
$this->autoRender = false;
$granaryid = $this->Session->read("granaryid");
$granary = $this->Granary->findById($granaryid);
$imgData = $granary["Granary"]['Image'];
$imgType = $granary["Granary"]["ImageType"];
header('Content-type: image/JPEG',true);
echo $imgData;
exit();
}
二、前台
var editbody = Ext.query(".x-panel-body","edit");
var imgElr = "<img src=\"/granaries/downloadimg?fn=<?php echo $fn;?>\" id=\"img\"></div>";
Ext.DomHelper.append(editbody[0].id,imgElr);
isShow = true;
[url]http://www.jamesfairhurst.co.uk/posts/view/uploading_files_and_images_with_cakephp[/url]
[url]http://bakery.cakephp.org/articles/view/file-upload-component-w-automagic-model-optional[/url]
[url]http://junnan.org/blog/?p=270[/url]
将图片从数据库中读出并显示
一、后台
function downloadimg()
{
$this->autoRender = false;
$granaryid = $this->Session->read("granaryid");
$granary = $this->Granary->findById($granaryid);
$imgData = $granary["Granary"]['Image'];
$imgType = $granary["Granary"]["ImageType"];
header('Content-type: image/JPEG',true);
echo $imgData;
exit();
}
二、前台
var editbody = Ext.query(".x-panel-body","edit");
var imgElr = "<img src=\"/granaries/downloadimg?fn=<?php echo $fn;?>\" id=\"img\"></div>";
Ext.DomHelper.append(editbody[0].id,imgElr);
isShow = true;