From 70e25ded664848f9442229799e18b1ab6257daa1 Mon Sep 17 00:00:00 2001 From: AnthonyAxenov Date: Wed, 25 Sep 2024 09:06:56 +0800 Subject: [PATCH] =?UTF-8?q?=D0=9B=D0=B5=D0=BD=D0=B8=D0=B2=D0=B0=D1=8F=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=B4=D0=B3=D1=80=D1=83=D0=B7=D0=BA=D0=B0=20=D1=8D?= =?UTF-8?q?=D1=81=D0=BA=D0=B8=D0=B7=D0=B0=20=D0=B4=D0=BB=D1=8F=20=D0=BE?= =?UTF-8?q?=D1=82=D1=81=D1=83=D1=82=D1=81=D1=82=D0=B2=D1=83=D1=8E=D1=89?= =?UTF-8?q?=D0=B5=D0=B3=D0=BE=20=D0=BB=D0=BE=D0=B3=D0=BE=D1=82=D0=B8=D0=BF?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/Controllers/PlaylistController.php | 3 +-- src/app/Core/ChannelLogo.php | 13 ++++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/app/Controllers/PlaylistController.php b/src/app/Controllers/PlaylistController.php index e2af52b..6d86b79 100644 --- a/src/app/Controllers/PlaylistController.php +++ b/src/app/Controllers/PlaylistController.php @@ -73,8 +73,7 @@ class PlaylistController extends Controller } if ($logo->size() === 0) { - Flight::notFound(); - die; + $logo->setDefault(); } $logo->store(); diff --git a/src/app/Core/ChannelLogo.php b/src/app/Core/ChannelLogo.php index 9933798..a3429b5 100644 --- a/src/app/Core/ChannelLogo.php +++ b/src/app/Core/ChannelLogo.php @@ -19,7 +19,7 @@ class ChannelLogo implements \Stringable /** * @var string|null Путь к файлу изображению на диске */ - public readonly ?string $path; + protected ?string $path; /** * @var string|null MIME-тип изображения @@ -114,6 +114,17 @@ class ChannelLogo implements \Stringable return is_string($this->rawData); } + /** + * Считывает дефолтный эскиз вместо логотипа + * + * @return bool + */ + public function setDefault(): bool + { + $this->path = root_path('public/no-tvg-logo.png'); + return$this->readFile(); + } + /** * Возвращает base64-кодированное изображение *