Image as link to original image in CDetail View


I am using following code to display product details on my view page:

<?php $this->widget(‘zii.widgets.CDetailView’, array(





                'label'=&gt;'Time to bid', 










                'value'=&gt;Yii::app()-&gt;baseUrl . '/images/projectthumbs/' . &#036;model-&gt;photo, 



It works well, however, the image that gets displayed is a small thumb of original thumbs, i want to make it a link to original image because i am saving them both.

Please suggest me a way to achive this!



This would probably work:

'value'=>CHtml::link(Yii::app()->baseUrl . '/images/projectthumbs/' . $model->photo, Yii::app()->baseUrl . '/images/' . $model->photo), 

Haven’t tested, though. ;)


Thanks for replying, but, i’ve already tested that, it works only for


Not for


And hence doesn’t display the image at all.

What I did in a project of mine was to just hardcode the img tag, like this::

CHtml::link('<img src="'.Yii::app()->baseUrl . '/images/projectthumbs/' . $model->photo .'"/>', array(Yii::app()->baseUrl . '/images/' . $model->photo, "id" => $user->id))

Type raw, of course.

Works like a charm.

But, it makes the url as:

which returns "Unable to resolve the request "zola/images/projectimages/809b.gif"."

Anyways, i used:

‘value’=>CHtml::link(’<img src="’.Yii::app()->baseUrl . ‘/images/projectthumbs/’ . $model->photo .’"/>’ , ‘#’, array (‘onclick’=>“’”.Yii::app()->baseUrl . “/images/projectimages/” . $model->photo ."’, ‘orgimage’, ‘height= 400, width=500’)" ))),

can u suggest me im displaying from database

is it correct if i put

‘value’=>’<img class=“imgbrder” src="’.$this->createUrl(‘loadImage&id=’.$model->primaryKey).’" alt="’.$model->fileName.’" />"’,

but i got diff i posted image can u help out

The your loadimage action first.

For example, can you see the image when you navigate to the action directly?