Skip to content

Commit

Permalink
BUG
Browse files Browse the repository at this point in the history
Исправлен баг с загрузкой миниатюр в другую папку
  • Loading branch information
Myks92 authored Jun 3, 2019
1 parent b5d8724 commit d503da0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Behavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => [
Expand Down Expand Up @@ -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])) {
Expand Down

0 comments on commit d503da0

Please sign in to comment.