How To Add Width Tag In Cdetailview To Display Image

I can show image in the details view reading this here in Yii topic. Now, I want to add width and alt tag into img tag. Is it possible?

I wrote as follows:




$this->widget('zii.widgets.CDetailView', array(

'data'=>$model,

'htmlOptions'=>array('class'=>'table table-striped responsive-table'),

'attributes'=>array(

    'id',

    'code',

    'name',

    'description',

    array(

        'type'=>'raw',

        'width'=>'200',

        'alt'=>'hi images',

        'value'=> CHtml::image(Yii::app()->request->baseUrl.'/images/products/'.$model->image),

    ),

    'price',

),

));






Thanks in advance.

You need to set them in the CHtml::image() call. The alt tag can be set in the second parameter and the width can be set in the third (htmlOptions) parameter.

thanks, I got it.