Show images directly for anime detail pages, so cover images are pulled correctly

This commit is contained in:
Timothy Warren 2022-01-10 16:56:10 -05:00
parent 2d6058a6b3
commit 7baa5bfe91
4 changed files with 6 additions and 4 deletions
app/views/anime
src/AnimeClient

View File

@ -7,7 +7,7 @@ use function Aviat\AnimeClient\getLocalImg;
<main class="details fixed">
<section class="flex" unselectable>
<aside class="info">
<?= $helper->picture("images/anime/{$data['id']}-original.webp") ?>
<?= $helper->picture($data['cover_image'], '.jpg', ['width' => '390'], ['width' => '390']) ?>
<br />

View File

@ -96,7 +96,9 @@ final class AnimeListTransformer extends AbstractTransformer {
'titles' => $titles,
'slug' => $anime['slug'],
'show_type' => (string)StringType::from($anime['subtype'])->upperCaseFirst(),
'cover_image' => $anime['posterImage']['views'][1]['url'] ?? '/public/images/placeholder.png',
'cover_image' => $anime['posterImage']['views'][1]['url']
?? $anime['posterImage']['original']['url']
?? '/public/images/placeholder.png',
'genres' => $genres,
'streaming_links' => $streamingLinks,
],

View File

@ -125,7 +125,7 @@ final class AnimeTransformer extends AbstractTransformer {
'age_rating' => $base['ageRating'],
'age_rating_guide' => $base['ageRatingGuide'],
'characters' => $characters,
'cover_image' => $base['posterImage']['views'][1]['url'],
'cover_image' => $base['posterImage']['original']['url'] ?? '/public/images/placeholder.png',
'episode_count' => $base['episodeCount'],
'episode_length' => $base['episodeLength'],
'genres' => $genres,

View File

@ -239,7 +239,7 @@ class Controller {
protected function renderFullPage(HtmlView $view, string $template, array $data): HtmlView
{
$csp = [
"default-src 'self'",
"default-src 'self' media.kitsu.io",
"object-src 'none'",
"child-src 'self' *.youtube.com polyfill.io",
];