logudotcom
(Logudotcom)
1
I am trying to display image name from database with directory path setting. I tried the below code, it does not show the actual image
//'value' => html_entity_decode('CHtml::image(Yii::app()->request->baseUrl.\'/uploads/slideshow/$model->image\')'),
'value' => html_entity_decode('CHtml::image(Yii::app()->request->baseUrl.\'/uploads/slideshow/$model->image\',\'Image\',array(\'width\'=>205,\'height\'=>150))'),
It always display, "Image" text
Ankit_Modi
(Ankit Modi)
2
[size=2]try this[/size]
array(
'name'=>'image',
'header'=>'Image',
'filter'=>'',
'type' => 'html',
'value'=> 'CHtml::tag("div", array("style"=>"text-align: center" ) , CHtml::tag("img", array("height"=>\''.$height.'\',\'width\'=>\''.$width.'\',"src" => UtilityHtml::getImageCoupon(GxHtml::valueEx($data,\'image\')))))',
),
public static function getImageCoupon($image)
{
if($image!='' && file_exists(YiiBase::getPathOfAlias('webroot').'/upload/coupon/'.$image)){
return Yii::app()->request->baseUrl.'/upload/coupon/'.$image;
}else {
return Yii::app()->request->baseUrl.'/upload/coupon/images.jpg';
}
}
please see wiki
logudotcom
(Logudotcom)
3
What is the use of "GxHtml::valueEx" ? where it is coming from?
I get this warning, include(GxHtml.php): failed to open stream: No such file or directory
Ankit_Modi
(Ankit Modi)
4
Yes i use the extesion giix-components so it’s extesion class
please see it
logudotcom
(Logudotcom)
5
Is it necessary to use for image display in cgview? because still, i am unable to display the image??
Ankit_Modi
(Ankit Modi)
6
Hi can you post the code?
logudotcom
(Logudotcom)
7
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'slideshow-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
array(
'name'=>'id',
'htmlOptions'=>array('width'=>'30'),
),
array('name'=>'image',
'type'=>'html',
'value' => html_entity_decode('CHtml::image(Yii::app()->request->baseUrl.\'/upload23s/slide23ow/'.$model->image.'\',\'Image\',array(\'width\'=>205,\'height\'=>150))'),
),
array(
'header'=>'Action',
'template'=>'{view} {delete}',
'class'=>'CButtonColumn',
'afterDelete'=>'function(link,success,data){ if(success) $("#statusMsg").html(data); }',
),
),
)); ?>
Ankit_Modi
(Ankit Modi)
8
Hi can you try the change
type =>'raw'
Ankit_Modi
(Ankit Modi)
9
Hi you can try this
'value'=>'CHtml::tag("div", array("style"=>"float: left; margin:5px; cursor:pointer" ,"onclick"=>"updatecustomer({$data["id"]})","id" => "{$data["id"]}","href"=>"javascript:void(0);") ,
CHtml::tag("img", array( "src" => "'.Yii::app()->request->baseUrl . '/upload23s/slide23ow/{$data["image"]}")))'
i hope it’s work.
logudotcom
(Logudotcom)
10
Thanks a ton. It worked finally.