Image display in CDetailView

How can I display images preview in CDetailView?

My view page is:







<?php $this->widget('zii.widgets.CDetailView', array(

	'data'=>$model,

	'attributes'=>array(

		'columnId',

		'column1',

		'column2',

		'column3',

		'picture',		

	),

)); ?>




I believe it should be something like:




<?php $this->widget('zii.widgets.CDetailView', array(

	'data'=>$model,

	'attributes'=>array(

		'columnId',

		'column1',

		'column2',

		'column3',

		array(               

                    'label'=>'My Pic',

                    'type'=>'image',

                    'value'=>'path/to/image.jpg',

                ),	

	),

)); ?>



Cheers,

Matt

Thanks man. It works. :)

Hi, i have this code but i need help in the value of the ‘value’, i wanna put the image path dynamically, is a field of a db, i put in value the name of a field of the db like ‘picture’, but in the source code appear ‘foto’ when it is: images/personas/1305888331.jpg, how can i put the field of the db?

My source code:




<?php

$this->breadcrumbs=array(

	'Personas'=>array('index'),

	$model->id,

);


$this->menu=array(

	array('label'=>'Llistar persones', 'url'=>array('index')),

	array('label'=>'Crear persona', 'url'=>array('create')),

	array('label'=>'Actualitzar persona', 'url'=>array('update', 'id'=>$model->id)),

	array('label'=>'Eliminar persona', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->id),'confirm'=>'Are you sure you want to delete this item?')),

	array('label'=>'Administrar persona', 'url'=>array('admin')),

);

?>


<h1>Veure Persona #<?php echo $model->id; ?></h1>


<?php $this->widget('zii.widgets.CDetailView', array(

	'data'=>$model,

	'attributes'=>array(

		'id',

		'dni',

		'nom',

		'cognoms',

		'adresa',

		'data_naiximent',

		'telefon_1',

		'telefon_2',

		'correu_electronic',

		'lloc_naiximent',

		'poblacio', 

		array(                  

			'label'=>'Foto',

			'type'=>'image',

			'value'=>'foto',

                ),

	),

)); ?>



[b]Grettings and thanks,

s0mk3t[/b]

if your model has a property named ‘someImage’ you can do the next:


array('name'=>'someImage', 'type'=>'image')

OR


array('label'=>'Image:', 'type'=>'image', 'value'=>$model->someImage)

It worked for me, Thanks.