From aa57a375cd8488c322e81bb28d7b1bf42e91fac3 Mon Sep 17 00:00:00 2001 From: Roardom Date: Thu, 13 Feb 2025 10:45:41 +0000 Subject: [PATCH] update: add fallback images to quicksearch --- .../Controllers/API/QuickSearchController.php | 4 +-- .../partials/quick-search-dropdown.blade.php | 27 ++++++++++++++++++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/API/QuickSearchController.php b/app/Http/Controllers/API/QuickSearchController.php index a28c62cec..16470f966 100644 --- a/app/Http/Controllers/API/QuickSearchController.php +++ b/app/Http/Controllers/API/QuickSearchController.php @@ -87,7 +87,7 @@ class QuickSearchController extends Controller 'id' => $hit['id'], 'name' => $hit[$type]['name'], 'year' => $hit[$type]['year'], - 'image' => $hit[$type]['poster'] ? tmdb_image('poster_small', $hit[$type]['poster']) : 'https://via.placeholder.com/90x135', + 'image' => $hit[$type]['poster'] ? tmdb_image('poster_small', $hit[$type]['poster']) : ($hit['name'][0] ?? '').($hit['name'][1] ?? ''), 'url' => route('torrents.similar', ['category_id' => $hit['category']['id'], 'tmdb' => $hit['tmdb']]), 'type' => $type === 'movie' ? 'Movie' : 'TV Series', ]; @@ -96,7 +96,7 @@ class QuickSearchController extends Controller 'id' => $hit['id'], 'name' => $hit['name'], 'year' => $hit['birthday'], - 'image' => $hit['still'] ? tmdb_image('poster_small', $hit['still']) : 'https://via.placeholder.com/90x135', + 'image' => $hit['still'] ? tmdb_image('poster_small', $hit['still']) : ($hit['name'][0] ?? '').(str($hit['name'])->explode(' ')->last()[0] ?? ''), 'url' => route('mediahub.persons.show', ['id' => $hit['id']]), 'type' => 'Person', ]; diff --git a/resources/views/partials/quick-search-dropdown.blade.php b/resources/views/partials/quick-search-dropdown.blade.php index e5a262052..518f24fbe 100755 --- a/resources/views/partials/quick-search-dropdown.blade.php +++ b/resources/views/partials/quick-search-dropdown.blade.php @@ -27,7 +27,7 @@ x-on:keydown.up.prevent="focusPreviousResult" > - +

2 + ? image + : 'data:image/svg+xml;charset=utf-8,' + + ` + + + + + + + + + ${image} + + `; + }, }; }