How To Insert Image In View Pages

I wanna ask how to insert image into a new view page. For example, I’d created a file named me.php and I put it into the general folder that I created earlier in Views. So when I open it through browser which is me.php, the image couldn’t load and can’t ever see the image. Can someone help me, I already use many codes to make it works,…

in ur view use CHtml::image(‘’,‘alt text’); for more info refer.


echo CHtml::image(Yii::app()->request->baseUrl.'/files/image.jpg','this is an alternative text',array('width'=>100,'height'=>100));


<img src="" alt="this is an alternative text" width="100" height="100" />

Please try this

echo CHtml::image(Yii::app()->request->baseUrl.'/images/imagename.png', "alt tag of image");