Display Image from database blob type

the image is showed, but its not full image. just half from it.

in view




$dbImage = Yii::app()->createUrl('photo/displaySavedImage', array('id' => my_id));

    echo CHtml::image($dbImage, 'image', array('width' => 200, 'height' => 200));



Model




    public function rules() {

            array('image', 'file', 'types' => 'jpg, png, gif'),

        );

    }




    public function beforeSave() {

        if ($file = CUploadedFile::getInstance($this, 'image')) {

            $this->imagename = $file->name;

            $this->imagetype = $file->type;

            $this->imagesize = $file->size;

            $this->image = file_get_contents($file->tempName);

        }

        return parent::beforeSave();

    }



Controller





    public function actionDisplaySavedImage() {

        

        $model = $this->loadModel($id);

        

	header('Pragma: public');

	header('Expires: 0');

	header('Cache-Control: must-revalidate, post-check=0, pre-check=0');

	header('Content-Transfer-Encoding: binary');

	header('Content-length: '.$model->imagesize);

	header('Content-Type: '.$model->imagetype);

	header('Content-Disposition: attachment; filename='.$model->imagename);


        echo $model->image;

    }



nothing wrong when saving the image.

but when display the image, it just display half of it like the image i uploaded.

please help me solved this question.

this is the image i’ve mentioned