How to download and display the second picture?

Hello, with one picture figured out how to download it and print it, but need more merchandise as and second download. The second picture is loaded, but with the conclusion of her trouble from me. Use it.

So far, everything in the admin part.

In the controller cards of the goods ordered when updated (yet):
public function actionUpdate($id)
{
 $model = $this->findModel($id);

 if ($model->load(Yii::$app->request->post()) && $model->save()) {
 $model->img = UploadedFile::getInstance($model, 'img'); // Photo to the small item cards
 $model->big = UploadedFile::getInstance($model, 'big'); // Photo to the big item cards
 if ($model->img) {
$model->upload();
 } elseif ($model->big) {
$model->uploadBig();
}

 return $this->redirect(['view', 'id' => $model->id]);
}

 return $this->render('update', [
 'model' => $model,
]);
 }


In the model of the item card, prescribed behavior, set the fields and functions for saving images:
public function behaviors()
{
 return [
 'image' => [
 'class' => 'rico\yii2images\behaviors\ImageBehave',
]
];
}

 public function rules()
{
 return [
 // other lines...
 [['img'], 'file', 'extensions' => 'png, jpg'],
 [['big'], 'file', 'extensions' => 'png, jpg'],
];
}

 public function upload() {
 if ($this->validate()) {
 $path = 'img/upload/' . $this->img->baseName . '.' . $this->img->extension; // Path to a file save (folder - file name - extension it).
$this->img->saveAs($path);
 $this->attachImage($path, true);
@unlink($path);
 return true;
 } else {
 return false;
}
}
 public function uploadBig() {
 if ($this->validate()) {
 $path = 'img/upload/' . $this->big->baseName . '.' . $this->big->extension; // Path to a file save (folder - file name - extension it).
$this->big->saveAs($path);
$this->attachImage($path);
@unlink($path);
 return true;
 } else {
 return false;
}
 }


On product view page (view) and fields where the picture should be:
<?php $img = $model->getImage(); $big = $model->getImage();?>

// 'image',
[
 'attribute' => 'img',
 'value' => '<img src="../../web/img/upload/' . $img->filePath . '" class="admin__img-view">',
 'format' => 'html',
],
// 'image_big',
[
 'attribute' => 'big',
 'value' => '<img src="../../web/img/upload/' . $big->filePath . '" class="admin__img-view">',
 'format' => 'html',
 ],


But something does not go to the second picture (the address to it). What am I doing wrong?
March 23rd 20 at 19:38
0 answer

Find more questions by tags Yii