diff --git a/app/Http/Controllers/CoverController.php b/app/Http/Controllers/CoverController.php index 3ca9a5f48..b70218a80 100644 --- a/app/Http/Controllers/CoverController.php +++ b/app/Http/Controllers/CoverController.php @@ -18,7 +18,7 @@ class CoverController extends Controller public function show(string $type, string $filename) { // Validate cover type - $validTypes = ['anime', 'audio', 'audiosample', 'book', 'console', 'games', 'movies', 'music', 'preview', 'sample', 'tvrage', 'video', 'xxx']; + $validTypes = ['anime', 'audio', 'audiosample', 'book', 'console', 'games', 'movies', 'music', 'preview', 'sample', 'tvrage', 'video', 'xxx', 'tvshows']; if (! in_array($type, $validTypes)) { abort(404); @@ -27,6 +27,18 @@ class CoverController extends Controller // Build the file path $filePath = storage_path("covers/{$type}/{$filename}"); + // For preview and sample images, try with _thumb suffix if original doesn't exist + if (! file_exists($filePath) && in_array($type, ['preview', 'sample'])) { + // Try with _thumb suffix + $pathInfo = pathinfo($filename); + $thumbFilename = $pathInfo['filename'].'_thumb.'.($pathInfo['extension'] ?? 'jpg'); + $thumbPath = storage_path("covers/{$type}/{$thumbFilename}"); + + if (file_exists($thumbPath)) { + $filePath = $thumbPath; + } + } + // Check if file exists if (! file_exists($filePath)) { // Return placeholder image @@ -37,9 +49,19 @@ class CoverController extends Controller abort(404); } + // Determine content type + $extension = strtolower(pathinfo($filePath, PATHINFO_EXTENSION)); + $contentType = match ($extension) { + 'jpg', 'jpeg' => 'image/jpeg', + 'png' => 'image/png', + 'gif' => 'image/gif', + 'webp' => 'image/webp', + default => 'image/jpeg', + }; + // Serve the file with proper headers return response()->file($filePath, [ - 'Content-Type' => 'image/jpeg', + 'Content-Type' => $contentType, 'Cache-Control' => 'public, max-age=31536000', // Cache for 1 year ]); } diff --git a/app/Http/Controllers/DetailsController.php b/app/Http/Controllers/DetailsController.php index d8e457a4c..634a9d33c 100644 --- a/app/Http/Controllers/DetailsController.php +++ b/app/Http/Controllers/DetailsController.php @@ -46,7 +46,8 @@ class DetailsController extends BasePageController ReleaseComment::addComment($data['id'], $data['gid'], $request->input('txtAddComment'), $this->userdata->id, $request->ip()); } - $nfo = ReleaseNfo::getReleaseNfo($data['id']); + $nfoData = ReleaseNfo::getReleaseNfo($data['id']); + $nfo = $nfoData ? $nfoData->nfo : null; $reVideo = $re->getVideo($data['id']); $reAudio = $re->getAudio($data['id']); $reSubs = $re->getSubs($data['id']); diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 2a4de8f1d..c2aa6e755 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -17,7 +17,7 @@ class AppServiceProvider extends ServiceProvider */ public function boot(): void { - Paginator::useBootstrapFive(); + Paginator::useTailwind(); $smarty = app('smarty.view'); view()->share('smarty', $smarty); Gate::define('viewPulse', function (User $user) { diff --git a/resources/views/browse/index.blade.php b/resources/views/browse/index.blade.php index 8b3624e22..f28f72938 100644 --- a/resources/views/browse/index.blade.php +++ b/resources/views/browse/index.blade.php @@ -104,6 +104,11 @@ + +
+ {{ $results->links() }} +
+
@@ -139,10 +144,18 @@ @endif + @if(isset($result->jpgstatus) && $result->jpgstatus == 1) + + @endif @if(isset($result->reid) && $result->reid != null) +
+

+
Preview
@@ -257,23 +273,28 @@ function closePreviewModal() { modal.classList.add('hidden'); } -function showPreviewImage(guid) { +function showPreviewImage(guid, type = 'preview') { const modal = document.getElementById('previewModal'); const img = document.getElementById('previewImage'); const error = document.getElementById('previewError'); + const title = document.getElementById('previewTitle'); // Show modal modal.style.display = 'flex'; modal.classList.remove('hidden'); - // Set image source - preview images are stored as {guid}.jpg in storage/covers/preview/ - const previewUrl = '/covers/preview/' + guid + '.jpg'; + // Set title based on type + title.textContent = type === 'sample' ? 'Sample Image' : 'Preview Image'; - img.src = previewUrl; + // Set image source - images are stored as {guid}.jpg in storage/covers/{type}/ + const imageUrl = '/covers/' + type + '/' + guid + '.jpg'; + + img.src = imageUrl; error.classList.add('hidden'); + img.style.display = 'block'; img.onerror = function() { - error.textContent = 'Preview image not available'; + error.textContent = (type === 'sample' ? 'Sample' : 'Preview') + ' image not available'; error.classList.remove('hidden'); img.style.display = 'none'; }; @@ -486,13 +507,20 @@ function showMediainfo(releaseId) { } document.addEventListener('DOMContentLoaded', function() { - // Preview badge click handlers + // Preview and Sample badge click handlers document.addEventListener('click', function(e) { const previewBadge = e.target.closest('.preview-badge'); if (previewBadge) { e.preventDefault(); const guid = previewBadge.dataset.guid; - showPreviewImage(guid); + showPreviewImage(guid, 'preview'); + } + + const sampleBadge = e.target.closest('.sample-badge'); + if (sampleBadge) { + e.preventDefault(); + const guid = sampleBadge.dataset.guid; + showPreviewImage(guid, 'sample'); } // Mediainfo badge click handlers diff --git a/resources/views/details/index.blade.php b/resources/views/details/index.blade.php index 378c05273..259bbe734 100644 --- a/resources/views/details/index.blade.php +++ b/resources/views/details/index.blade.php @@ -42,26 +42,49 @@
- @if(isset($release->haspreview) && $release->haspreview == 1) + @php + $hasPreviewImage = isset($release->haspreview) && $release->haspreview == 1; + $hasSampleImage = isset($release->jpgstatus) && $release->jpgstatus == 1; + @endphp + + @if($hasPreviewImage || $hasSampleImage)

- Sample Images + + @if($hasPreviewImage && $hasSampleImage) + Preview & Sample Images + @elseif($hasPreviewImage) + Preview Image + @else + Sample Image + @endif

- - - Preview - - - - Sample - + @if($hasPreviewImage) + +
+ + Preview + +

Preview

+
+ @endif + + @if($hasSampleImage) + +
+ + Sample + +

Sample

+
+ @endif
@endif