From 53fe66a364e0bb883e49fa56523f5ddaeeaef558 Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Sun, 29 Dec 2024 15:10:41 -0600 Subject: [PATCH] Initialize empty values for some image URLs --- lib/Ebook.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/Ebook.php b/lib/Ebook.php index e779e335..e43f9afd 100644 --- a/lib/Ebook.php +++ b/lib/Ebook.php @@ -464,6 +464,9 @@ final class Ebook{ if(file_exists(WEB_ROOT . '/images/covers/' . $this->UrlSafeIdentifier . '-hero.avif')){ $this->_HeroImageAvifUrl = '/images/covers/' . $this->UrlSafeIdentifier . '-' . substr(sha1($this->Updated->format(Enums\DateTimeFormat::UnixTimestamp->value)), 0, 8) . '-hero.avif'; } + else{ + $this->_HeroImageAvifUrl = ''; + } } return $this->_HeroImageAvifUrl; @@ -482,6 +485,9 @@ final class Ebook{ if(file_exists(WEB_ROOT . '/images/covers/' . $this->UrlSafeIdentifier . '-hero@2x.avif')){ $this->_HeroImage2xAvifUrl = '/images/covers/' . $this->UrlSafeIdentifier . '-' . substr(sha1($this->Updated->format(Enums\DateTimeFormat::UnixTimestamp->value)), 0, 8) . '-hero@2x.avif'; } + else{ + $this->_HeroImage2xAvifUrl = ''; + } } return $this->_HeroImage2xAvifUrl; @@ -500,6 +506,9 @@ final class Ebook{ if(file_exists(WEB_ROOT . '/images/covers/' . $this->UrlSafeIdentifier . '-cover.avif')){ $this->_CoverImageAvifUrl = '/images/covers/' . $this->UrlSafeIdentifier . '-' . substr(sha1($this->Updated->format(Enums\DateTimeFormat::UnixTimestamp->value)), 0, 8) . '-cover.avif'; } + else{ + $this->_CoverImageAvifUrl = ''; + } } return $this->_CoverImageAvifUrl; @@ -518,6 +527,9 @@ final class Ebook{ if(file_exists(WEB_ROOT . '/images/covers/' . $this->UrlSafeIdentifier . '-cover@2x.avif')){ $this->_CoverImage2xAvifUrl = '/images/covers/' . $this->UrlSafeIdentifier . '-' . substr(sha1($this->Updated->format(Enums\DateTimeFormat::UnixTimestamp->value)), 0, 8) . '-cover@2x.avif'; } + else{ + $this->_CoverImage2xAvifUrl = ''; + } } return $this->_CoverImage2xAvifUrl;