From 92b2af6191f9cb10e711cab062f304485cb9f9a5 Mon Sep 17 00:00:00 2001 From: Sasha Rybkin Date: Tue, 11 Mar 2025 13:18:58 +0300 Subject: [PATCH] =?UTF-8?q?#108935=20=D0=98=D1=81=D1=81=D0=BB=D0=B5=D0=B4?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20=D0=B2=D0=BE=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D1=81=20=D1=81=20=D0=BF=D0=BE=D0=B4=D0=B4=D0=B5=D1=80=D0=B6?= =?UTF-8?q?=D0=BA=D0=BE=D0=B9=20=D0=B0=D0=BB=D1=8C=D1=84=D0=B0-=D0=BA?= =?UTF-8?q?=D0=B0=D0=BD=D0=B0=D0=BB=D0=B0=20=D0=BF=D1=80=D0=B8=20=D1=81?= =?UTF-8?q?=D0=BE=D1=85=D1=80=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8=D0=B8=20png-?= =?UTF-8?q?=D0=B8=D0=B7=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B9=20=D1=81=D1=82=D0=B8=D0=BA=D0=B5=D1=80=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- File.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/File.php b/File.php index fdb7f1d..993b3de 100644 --- a/File.php +++ b/File.php @@ -178,9 +178,9 @@ class File extends \yii\db\ActiveRecord $this->ext = $this->file->extension; $this->md5 = md5_file($this->file->tempName); $patch = $this->getDir(true); - if ($this->isImage && $this->ext != 'jpg') //не конвертируем изображение в jpg если оно уже jpg + if ($this->isImage && $this->ext != 'jpg' && $this->convertJpg) //не конвертируем изображение в jpg если оно уже jpg { - $this->ext = $this->convertJpg ? 'jpg' : $this->ext; + $this->ext = 'jpg'; $this->name = $this->getFileName(); $fileName = $this->name . '.' . $this->ext; @@ -414,7 +414,7 @@ class File extends \yii\db\ActiveRecord */ protected function deleteBorder($filePatch) { - $img = imagecreatefromjpeg($filePatch); + $img = $this->ext == 'jpg' ? imagecreatefromjpeg($filePatch) : imagecreatefrompng($filePatch); $this->width = $this->width > 0 ? $this->width : imagesx($img); $this->height = $this->height > 0 ? $this->height : imagesy($img);