From d503da0c09eb67c8f197153053e35e1be00eb808 Mon Sep 17 00:00:00 2001 From: maxdancepro <31630905+maxdancepro@users.noreply.github.com> Date: Tue, 4 Jun 2019 01:50:13 +0300 Subject: [PATCH] BUG MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Исправлен баг с загрузкой миниатюр в другую папку --- src/Behavior.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Behavior.php b/src/Behavior.php index a8cddbb..1addd67 100644 --- a/src/Behavior.php +++ b/src/Behavior.php @@ -25,7 +25,7 @@ * 'class' => \maxdancepro\image\Behavior::className(), * 'savePathAlias' => '@web/images/', * 'urlPrefix' => '/images/', - * 'deleteFileName' => 'avatar.jpg', + * 'fileName' => 'avatar.jpg', * 'deleteFileName' => 'avatar.jpg', * 'crop' => true, * 'attributes' => [ @@ -148,16 +148,16 @@ public function beforeSave() if ($this->issetThumbnails($attr)) { $thumbnails = $this->attributes[$attr]['thumbnails']; - foreach ($thumbnails as $name => $options) { - $this->ensureAttribute($name, $options); - $tmbFileName = $name . DIRECTORY_SEPARATOR . $fileName; + foreach ($thumbnails as $tmb => $options) { + $this->ensureAttribute($tmb, $options); + $tmbFileName = $tmb . DIRECTORY_SEPARATOR . $fileName; $image = $this->processImage($this->getSavePath($attr) . $fileName, $options); - $dir = $this->getSavePath($attr).$name; + $dir = $this->getSavePath($attr, $tmb).$tmb; if (!is_dir($dir)) { FileHelper::createDirectory($dir); } - $image->save($this->getSavePath($attr) . $tmbFileName); + $image->save($this->getSavePath($attr, $tmb) . $tmbFileName); } } } elseif (isset($model->oldAttributes[$attr])) {