mjonutz
(Ionut Fbi12)
November 1, 2011, 6:59am
1
I want to display an image in the CdetailView for my actor model.
<?php $this->widget('zii.widgets.CDetailView', array(
'data'=>$model,
'attributes'=>array(
'actor_id',
array(
'name'=>'picture',
'value'=> '<img src="../test/images/actor.jpg" alt="alt" width="200" height="150" />',
),
'last_update',
),
)); ?>
In the corresponding view, the image is not displayed, instead is displayed the text. The path is correctly chosen, but i encounter problems on the image render.
jayant
(Codesutras)
November 1, 2011, 7:10am
3
mjonutz:
I want to display an image in the CdetailView for my actor model.
<?php $this->widget('zii.widgets.CDetailView', array(
'data'=>$model,
'attributes'=>array(
'actor_id',
array(
'name'=>'picture',
'value'=> '<img src="../test/images/actor.jpg" alt="alt" width="200" height="150" />',
),
'last_update',
),
)); ?>
In the corresponding view, the image is not displayed, instead is displayed the text. The path is correctly chosen, but i encounter problems on the image render.
Use
CHtml::image($src);
with a exact stored Directory path of the image. Like
$bUrl=Yii::app()->baseUrl; //base URL
$tUrl=Yii::app()->theme->baseUrl; //theme URl
Where is your image is stored in a project.try this might be this will help you.