Unfortunately, it is not possible, according to the CDataColumn object of the CGridView lib components.
protected function renderDataCellContent($row,$data)
{
if($this->value!==null)
$value=$this->evaluateExpression($this->value,array('data'=>$data,'row'=>$row));
else if($this->name!==null)
$value=CHtml::value($data,$this->name);
echo $value===null ? $this->grid->nullDisplay : $this->grid->getFormatter()->format($value,$this->type);
}
What i normally do is to create a property on the MODEL
public function getThumbnail(){
// here i return the image
return CHtml::image('sourtoimage'.$this->user_image_url,'alt of image',array('width'=>48,'height'=>48));
}
Then on the CGridView make sure the type is set as ‘raw’
Cheers
edit:
There is also another way, you can use the htmlOptions of the ROW (td) to set up the image size:
td.myclass img{
width: '48px';
height: '48px';
}
Then, as Haensel, said, do
array(
'name'=>'user_image_url',
'type'=>'image',
'htmlOptions'=>array('class'=>'myclass'),
),
You can see that htmlOptions are actually related to the TD tag, not its content.
public function renderDataCell($row)
{
$data=$this->grid->dataProvider->data[$row];
$options=$this->htmlOptions;
if($this->cssClassExpression!==null)
{
$class=$this->evaluateExpression($this->cssClassExpression,array('row'=>$row,'data'=>$data));
if(isset($options['class']))
$options['class'].=' '.$class;
else
$options['class']=$class;
}
echo CHtml::openTag('td',$options);
$this->renderDataCellContent($row,$data);
echo '</td>';
}