Json decode with full url

successfully create the json file

Actual output

{

id: "1",

images: "/images/feature/01.jpg",

},

However, how to make the absolute url for the image path? Cuz currently i only save the url in database with /images/01.jpg

If i wan something like "xxx.com/images/feature/01.jpg"

How to add the "xxx.com/" with database value?

Desire output

{

id: "1",

images: "xxx.com/images/feature/01.jpg",

},

below is my original code

public function actionIndex()

	{


       $Criteria = new CDbCriteria();


       $model = FeatureImage::model()->findAll($Criteria);         


       if (empty($model)) $this->__fail('Not found');


      


        $response = [];


            foreach ($model as $model) {


            $response[] = array(  


             'id' => $model->id,


             'images' => $model->image,


                );


            } 





        echo json_encode($response);


        exit();


}

Please advise how to modify it.

protected/config/main.php:


	'params'=>array(

		'siteUrl'=>'http://www.mysiterocks.com/',

	),

Now, in your index action:


	'images' => Yii::app()->params['siteUrl'] . $model->image,

Thank you !!