diff --git a/common/modules/attachment/Module.php b/common/modules/attachment/Module.php index 3bbee556..4f4116c4 100644 --- a/common/modules/attachment/Module.php +++ b/common/modules/attachment/Module.php @@ -22,7 +22,7 @@ public function bootstrap($app) 'path' => '@storagePath/upload', ], 'baseUrl' => '@storageUrl/upload', - 'imageProcessor' => 'common\modules\attachment\components\image\Local' + 'imageProcessor' => ['class' => 'common\modules\attachment\components\image\Local'] ]; if (isset($this->params['filesystem_type'])) { switch ($this->params['filesystem_type']) { diff --git a/common/modules/attachment/components/Storage.php b/common/modules/attachment/components/Storage.php index 7ba4a2d8..2156e2e2 100644 --- a/common/modules/attachment/components/Storage.php +++ b/common/modules/attachment/components/Storage.php @@ -32,7 +32,7 @@ public function init() parent::init(); $this->baseUrl = \Yii::getAlias($this->baseUrl); $this->fs = \Yii::createObject($this->fs); - $this->imageProcessor = \Yii::createObject($this->imageProcessor, ['baseUrl' => $this->baseUrl]); + $this->imageProcessor = \Yii::createObject(ArrayHelper::merge($this->imageProcessor, ['baseUrl' => $this->baseUrl])); } public function getPath($url) diff --git a/common/modules/attachment/models/Attachment.php b/common/modules/attachment/models/Attachment.php index f1600545..d2e25c30 100644 --- a/common/modules/attachment/models/Attachment.php +++ b/common/modules/attachment/models/Attachment.php @@ -234,7 +234,7 @@ public function makeCropStorage($width, $height, $x, $y) $attachment = static::findByHash($hash); if (empty($attachment)) { $fileName = $hash . '.' . $this->extension; - $path = trim(pathinfo($this->path, PATHINFO_DIRNAME), ''); + $path = trim(pathinfo($this->path, PATHINFO_DIRNAME), '.'); $filePath = ($path ? ($path . '/') : '') . $fileName; if (Yii::$app->storage->upload($filePath, $url)) { $attachment = new static();