image from database

in view


    <?php echo CHtml::encode($model->getAttributeLabel('image')); ?>:

    <?php echo CHtml::image($model->image); ?>

in controller:


public function actionProfile()

        {

            $blogger_id     =   3;

            $model          =    Blogger::model()->find(array('condition'=>"id='$blogger_id'"));

            $this->render('profile',array('model'=>$model));

        }

i save image in blob in database but it not showing the image .Plz help me.

i also use


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

	'data'=>$model,

	'attributes'=>array(	

		array(

            'name'=>'image',

            'type'=>'raw',            

        ),

	),

)); ?>

but it shows the some codes not image how should in convert that code into image

Try like this -

I think you also need to specify the directory path, where your image is located.

eg. -


CHtml::image(Yii::app()->request->baseUrl.'/images/'.$model->image);

If its stored as a blob, I think you have to set the appropriate content type for it to display. See this link:

http://www.yiiframework.com/wiki/332/storing-your-images-in-your-table-s-blob-field-and-displaying-that-stored-images/