How To Display Blob Image On Tcpdf In Yii?

Is there a way to display a blob image in TCPDF in Yii? I’ve tried calling the function below but it just returns a blank picture.

My controller:


public function actionDisplayAgencyIcon()

{

        $info = BaseAgencyInfo::model()->find();

        $id = $info->agencyID;


        if($id == null || trim($id)=='') {

        echo "error in image, bad ID value [{$id}]";

        exit();

        }


        $model=BaseAgencyInfo::model()->find("agencyID = '{$id}'");


        if($model->agency_logo == null){

        echo "error in image, using ID [{$id}] ";

        exit();

        }


header('Content-Type: gif,jpeg,png');

echo $model->agency_logo;

}

So, any ideas how to achieve this?

[b]Can you check with this code

in controller[/b]


public function actionDisplaySavedImage()

                {

                        $model=$this->loadModel($_GET['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->photo_file_size);

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

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

                 

                                //echo '<img src="'.base64_decode($model->photo_data).'" />';

                                echo $model->photo_data;

                }

in view


echo '<img class="imgbrder" src="'.$this->createUrl('DisplaySavedImage&id='.$model->primaryKey).'" alt="'.$model->photo_file_name.'" width="101" height="107" />';

Make necessary change to suit to your code structure, This may help you

I had to sign in just to thank you sir. You are a gentlemen and a scholar. :lol:

thank you…