I want to encode blob image from DB to base64 string, then I want to encode the string with JSON.
I’ve tried this:
$img = Image::model()->findBySql('SELECT img FROM tbl_img WHERE id=1');
$value = chunk_split(base64_encode($img));
echo CJSON::encode($value);
But I’ve got nothing. Can anyone help?
Thanks