无法在 Yii 中显示图像 [英] cannot display image in Yii
本文介绍了无法在 Yii 中显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在 CDetailView 中显示图像,这是我的代码:
I'm trying to display image in CDetailView, this is my code :
<?php
$this->widget('zii.widgets.CDetailView', array(
'data'=>$model,
'attributes'=>array(
'image',
array(
'name'=>'image',
'type'=>'raw',
'value'=> CHtml::image(Yii::app()->request->baseUrl.'../../../images/arsip/'.$model->image),
),
),
));
?>
页面可以查看,但是图像无法显示,我也在尝试 'value'=>html_entity_decode(CHtml::image($model->image,'alt',array('width'=>341,'height'=>232))),
但只显示 'alt' 字符串.
the page can view, but the image cannot display, I'm also trying with 'value'=>html_entity_decode(CHtml::image($model->image,'alt',array('width'=>341,'height'=>232))),
but only display the 'alt' string.
推荐答案
首先观察mozilla firebug中的图片路径.
First Observer the image path in mozilla firebug.
我希望这是你的文件夹结构
I hope this is your folder Structure
App
|
|
----assets
|
|
----css
|
|
----images
| |
| |
| ---------arsip
|
----protected
|
|
----themes
如果这是.. 像下面一样更改路径.
If this is.. Change the path like below.
CHtml::image(Yii::app()->baseUrl . '/images/arsip/'..$model->image),
这篇关于无法在 Yii 中显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文