Hi there,
I have a file upload field to upload an image, in the view I want to display the uploaded image which I have achieved like this in view.php:
array(
'name'=>'main_image',
'label'=>'Main Image',
'type'=>'raw',
'value'=>html_entity_decode(CHtml::image(Yii::app()->baseUrl . '/mainImages/'.$model->main_image,'Main Image (this is the alt tag)',array('width'=>200))),
),
But I only want it to display if the image has been uploaded. So I guess I need to check if $model->main_image is empty or not. What’s the best way to do this?
Thanks in advance!