user3312884
user3312884

Reputation: 97

how to give height and width to image in yii CDetailview

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

Answers (2)

Hearaman
Hearaman

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

Carlos Manzo
Carlos Manzo

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

Related Questions