Display Thumb Image In Cgridview ?

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

[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

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

Yes i use the extesion giix-components so it’s extesion class

please see it

Is it necessary to use for image display in cgview? because still, i am unable to display the image??

Hi can you post the code?




<?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); }',

		),

	),

)); ?>

Hi can you try the change


type =>'raw'

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.

Thanks a ton. It worked finally.