Is it possible to show an image with Yii CForm formbuilder?

120 Views Asked by At

I'm looking for a easy way to show an image in a CForm formbuilder array. But I want to show the model contents, something like this example:

array(
    'elements'=>array(
        '<img src="$this->thumbnail" />',
        'thumbnail'=>array(
            'type'=>'file',
        ),
    ),
)

Is that possible?

1

There are 1 best solutions below

0
On BEST ANSWER

Found it, this works.

return array(
    'elements'=>array(
        '<img src="'.$this->getModel()->thumbnail.'" alt="" />',
        'thumbnail'=>array(
            'type'=>'file',
        ),
    ),
);