Reputation: 97
I upload image and need to show it on details view.I have write below code but fail to set height and width.
array(
'name' => 'slide_image_name',
'type' => 'raw',
'value' => CHtml::image(yii::app()->baseUrl."/images/slider/".$model->slide_image_name,array('width'=>200,'height'=>100,)),
),
Thanks in advance.
Upvotes: 0
Views: 181
Reputation: 8736
Try this
array(
'header' => 'slide_image_name',
'type' => 'html',
'value' => 'CHtml::image("path/to/image_folder/".$data->slide_image_name, "Alt text",array("style"=>"width:200px;height:100px"))'
),
Upvotes: 1
Reputation: 99
Try this:
array(
'label'=>'slide_image_name',
'type'=>'raw',
'value'=>html_entity_decode(CHtml::image($model->slide_image_name,'alt',array('width'=>200,'height'=>100))),
),
Upvotes: 0