Hello,
I am using following code to display product details on my view page:
<?php $this->widget(‘zii.widgets.CDetailView’, array(
'data'=>$model,
'attributes'=>array(
'title',
array(
'label'=>'Time to bid',
'value'=>$timetobid,
),
array(
'label'=>'Budget',
'value'=>$budget,
),
array(
'label'=>'Photo',
'type'=>'image',
'value'=>Yii::app()->baseUrl . '/images/projectthumbs/' . $model->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!
Thanks,
Kul.
jacmoe
(Jacob Moen)
April 25, 2011, 8:03am
2
This would probably work:
'value'=>CHtml::link(Yii::app()->baseUrl . '/images/projectthumbs/' . $model->photo, Yii::app()->baseUrl . '/images/' . $model->photo),
Haven’t tested, though.
jacmoe:
This would probably work:
'value'=>CHtml::link(Yii::app()->baseUrl . '/images/projectthumbs/' . $model->photo, Yii::app()->baseUrl . '/images/' . $model->photo),
Haven’t tested, though.
Hi,
Thanks for replying, but, i’ve already tested that, it works only for
‘type’=>‘raw’,
Not for
‘type’=>‘image’,
And hence doesn’t display the image at all.
jacmoe
(Jacob Moen)
April 25, 2011, 12:19pm
4
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.
jacmoe:
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:
http://www.servername.com/index.php?r=zola/images/projectimages/809b.gif
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’=>“window.open(’”.Yii::app()->baseUrl . “/images/projectimages/” . $model->photo ."’, ‘orgimage’, ‘height= 400, width=500’)" ))),
jacmoe:
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.
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
jacmoe
(Jacob Moen)
April 9, 2013, 1:20pm
8
The your loadimage action first.
For example, can you see the image when you navigate to the action directly?