NOW MANAGED ON CODEBERG
Code cleanup, bug squashing
James Geigera0bfdf0e5c61
diff --git a/app/Entities/Models/Page.php b/app/Entities/Models/Page.phpindex c244219ea..89ed26ea8 100644--- a/app/Entities/Models/Page.php+++ b/app/Entities/Models/Page.php@@ -130,9 +130,10 @@ class Page extends BookChild/*** Returns URL to a cover image for the page.*/- public function getCoverImage(): string+ public function getCoverImage(){- $default = $this->book->getBookCover();+ //$default = $this->book->getBookCover();+ $default = url('/logo.png');$firstImage = (new PageContent($this))->fetchFirstImage();diff --git a/app/Entities/Tools/PageContent.php b/app/Entities/Tools/PageContent.phpindex 51562e71f..84506f671 100644--- a/app/Entities/Tools/PageContent.php+++ b/app/Entities/Tools/PageContent.php@@ -362,7 +362,7 @@ class PageContent/*** Retrieve first image in page content and return the source URL.*/- public function fetchFirstImage(): string+ public function fetchFirstImage(){$htmlContent = $this->page->html;@@ -370,6 +370,6 @@ class PageContent$dom->loadHTML($htmlContent);$images = $dom->getElementsByTagName('img');- return $images ? $images[0]->getAttribute('src') : null;+ return $images->length > 0 ? $images[0]->getAttribute('src') : null;}}diff --git a/resources/views/pages/show.blade.php b/resources/views/pages/show.blade.phpindex 0810feeb1..35f0d1229 100644--- a/resources/views/pages/show.blade.php+++ b/resources/views/pages/show.blade.php@@ -3,9 +3,6 @@@push('social-meta')<meta property="og:description" content="{{ Str::limit($page->text, 100, '...') }}"><meta property="og:image" content="{{ $page->getCoverImage() }}">--- $pageContent->getNavigation($page->html);@endpush@section('body')