How to show uploaded image in view page? I am new in yii, I am unable to fix this please help me

59 Views Asked by At

In myprofile.php

 <?php echo CHtml::image(Yii::app()->request- >baseUrl.'/xampp/htdocs/myapp/images/'.$model- >image,"image",array("width"=>200,"hieght"=>200)); ?> 
3

There are 3 best solutions below

0
On BEST ANSWER

Your image url is incorrect.

Yii::app()->request- >baseUrl.'/xampp/htdocs/myapp/images/'.$model- >image

should be change into:

Yii::app()->request->baseUrl.'/images/'.$model->image

0
On

Yii::app()->request->baseUrl allready contains you app root directory so you don't need to use xampp/htdocs/myapp .

try to use this

<?php echo CHtml::image(Yii::app()->request->baseUrl.'/images/'.$model->image,"image",array("width"=>200,"hieght"=>200)); ?>
0
On

Use this.

 <?php echo CHtml::image(Yii::app()->getBaseUrl(true) .'/images/'.$model->image,'',array('width'=>230,'height'=>500)); ?>