phpyiicdetailview

Yii show image in CDetailView


I have stored image in Images Folder(root) In my Yii project. I want to show image in CDetailView that is in protected/view/college

my code

array(
            'label'=>'CollegeLogo',
            'type'=>'raw',
            'value'=>CHtml::image("../".Yii::app()->baseUrl."/Images/".$model->CollegeLogo),

        ),

it is not working


Solution

  • remove "../" in your code. Baseurl will return path from root folder.

    'value'=>CHtml::image(Yii::app()->baseUrl."/Images/".$model->CollegeLogo),