mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 03:01:34 +00:00
Fix anime covers display
This commit is contained in:
@@ -507,7 +507,7 @@ if (! function_exists('getReleaseCover')) {
|
||||
} elseif (! empty($xxxinfo_id)) {
|
||||
$coverType = 'xxx';
|
||||
$coverId = $xxxinfo_id;
|
||||
} elseif (! empty($anidbid)) {
|
||||
} elseif (! empty($anidbid) && $anidbid > 0) {
|
||||
$coverType = 'anime';
|
||||
$coverId = $anidbid;
|
||||
}
|
||||
|
||||
@@ -38,6 +38,20 @@ class CoverController extends Controller
|
||||
$filePath = storage_path("covers/{$type}/{$filename}");
|
||||
}
|
||||
} elseif ($type === 'anime') {
|
||||
// For anime, check if the ID is valid (must be > 0)
|
||||
// Reject covers for anidbid <= 0 (failed processing, no match, etc.)
|
||||
if (preg_match('/^(-?\d+)(?:-cover)?\.jpg$/', $filename, $matches)) {
|
||||
$anidbid = (int) $matches[1];
|
||||
if ($anidbid <= 0) {
|
||||
// Return placeholder for invalid IDs
|
||||
$placeholderPath = public_path('assets/images/no-cover.png');
|
||||
if (file_exists($placeholderPath)) {
|
||||
return response()->file($placeholderPath);
|
||||
}
|
||||
abort(404);
|
||||
}
|
||||
}
|
||||
|
||||
// For anime, try the requested filename first, then fall back to old format (without -cover)
|
||||
$filePath = storage_path("covers/{$type}/{$filename}");
|
||||
|
||||
|
||||
@@ -125,8 +125,7 @@
|
||||
</label>
|
||||
<div class="border border-gray-300 dark:border-gray-600 rounded-lg p-4 bg-gray-50 dark:bg-gray-900">
|
||||
@php
|
||||
$coverPath = storage_path('covers/anime/' . $anime['anidbid'] . '-cover.jpg');
|
||||
$hasCover = file_exists($coverPath);
|
||||
$hasCover = $anime['anidbid'] > 0 && file_exists(storage_path('covers/anime/' . $anime['anidbid'] . '-cover.jpg'));
|
||||
@endphp
|
||||
@if($hasCover)
|
||||
<img src="{{ url('/covers/anime/' . $anime['anidbid'] . '-cover.jpg') }}"
|
||||
|
||||
@@ -61,8 +61,7 @@
|
||||
<tr class="hover:bg-gray-50 dark:hover:bg-gray-700">
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
@php
|
||||
$coverPath = storage_path('covers/anime/' . $anime->anidbid . '-cover.jpg');
|
||||
$hasCover = file_exists($coverPath);
|
||||
$hasCover = $anime->anidbid > 0 && file_exists(storage_path('covers/anime/' . $anime->anidbid . '-cover.jpg'));
|
||||
@endphp
|
||||
@if($hasCover)
|
||||
<img src="{{ url('/covers/anime/' . $anime->anidbid . '-cover.jpg') }}"
|
||||
|
||||
Reference in New Issue
Block a user