Greetings
I need to display images stored in BLOB database fields in a LISTVIEW or similar widget from Yii2
I have the actionCreate that saves the image in table named honra as a BLOB
public function actionCreate()
{
    $model = new Honra();
    if ($model->load(Yii::$app->request->post()) && $model->save()) {
        $file = UploadedFile::getInstance($model,'binaryfile');
        $model->binaryfile=$file;
        return $this->redirect(['view', 'id' => $model->id]);
    } else {
        return $this->render('create', [
            'model' => $model,
        ]);
    }
}
I also have the model named Honra
class Honra extends \yii\db\ActiveRecord{
public static function tableName()
{
    return 'honra';
}
/**
 * @inheritdoc
 */
public function rules()
{
    return [
        [['nome', 'texto'], 'required'],
        [['texto', 'binaryfile'], 'string'],
        [['ativo'], 'integer'],
        [['nome'], 'string', 'max' => 255],
        [['fileName'], 'string', 'max' => 100],
        [['fileType'], 'string', 'max' => 50]
    ];
}
/**
 * @inheritdoc
 */
public function attributeLabels()
{
    return [
        'id' => Yii::t('app', 'ID'),
        'nome' => Yii::t('app', 'Nome'),
        'texto' => Yii::t('app', 'Texto'),
        'fileName' => Yii::t('app', 'File Name'),
        'fileType' => Yii::t('app', 'File Type'),
        'binaryfile' => Yii::t('app', 'Binaryfile'),
        'ativo' => Yii::t('app', 'Ativo'),
    ];
}
}
The images are successfully stored in the table field named binaryfile
And i need to display each blob image stored in database in a view named view2 inside a LISTVIEW or similar widget
Anyone knows what block of code i need to put in view2 and the HonraController to achieve this ??
EDIT
SOLVED
HERE IS THE CODE THAT SOLVED THE ISSUE, NOW EVERYTHING IS WORKING WELL
public function actionCreate()
{
    $model = new Honra();
     if (Yii::$app->request->isPost) {
            $model->file = UploadedFile::getInstance($model, 'file');
            $filePath = 'uploadsimg/'  . $model->file->baseName . '.' . $model->file->extension;
            $model->fileName = $filePath;
            $model->save();
            $model->file->saveAs('uploadsimg/' . $model->file->baseName . '.' . $model->file->extension);
            if ($model->load(Yii::$app->request->post()) && $model->save()) {
                return $this->redirect(Url::toRoute(['create']));
            }
        }
        return $this->render('create', ['model' => $model]);
}
MANY THANKS FOR THE HELP MIHAI
 
     
    