I am using yii1 and facing problem in adding class to image shown in detail view , tell me how to add css class or static property to image to make width and height 40px; my detail view code is below
<?php
$this->widget('zii.widgets.CDetailView', array(
'data' => $model,
'attributes' => array(
'id',
'title',
array(
'label' => 'image',
'type' => 'image',
'value' => Yii::app()->baseUrl . '/images/foodcategory/'
.$model->image ,
),
'status',
'created_at',
'created_by',
'modified_at',
'modified_by',
),
));
?>
Change the type to raw
. You can then add it using CHtml::image()
:
array(
'label' => 'image',
'type' => 'raw',
'value' => CHtml::image(
Yii::app()->baseUrl . '/images/foodcategory/'.$model->image,
'Alt text',
array('class' => 'myclass') //and other html tag attributes
),
),