Version 5.1 - All the GraphQL #32
@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Aviat\AnimeClient\Kitsu;
|
||||
use function Aviat\AnimeClient\getLocalImg;
|
||||
|
||||
?>
|
||||
<main class="details fixed">
|
||||
@ -162,14 +161,14 @@ use function Aviat\AnimeClient\getLocalImg;
|
||||
use ($component, $url, $helper) {
|
||||
$rendered = [];
|
||||
foreach ($characterList as $id => $character):
|
||||
if (empty($character['image']['original']))
|
||||
if (empty($character['image']))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$rendered[] = $component->character(
|
||||
$character['name'],
|
||||
$url->generate('character', ['slug' => $character['slug']]),
|
||||
$helper->picture("images/characters/{$id}.webp"),
|
||||
$helper->img($character['image']),
|
||||
(strtolower($role) !== 'main') ? 'small-character' : 'character'
|
||||
);
|
||||
endforeach;
|
||||
@ -187,14 +186,14 @@ use function Aviat\AnimeClient\getLocalImg;
|
||||
use ($component, $url, $helper) {
|
||||
$rendered = [];
|
||||
foreach ($staffList as $id => $person):
|
||||
if (empty($person['image']['original']))
|
||||
if (empty($person['image']))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$rendered[] = $component->character(
|
||||
$person['name'],
|
||||
$url->generate('person', ['slug' => $person['slug']]),
|
||||
$helper->picture(getLocalImg($person['image']['original'] ?? NULL)),
|
||||
$helper->img($person['image']),
|
||||
'character small-person',
|
||||
);
|
||||
endforeach;
|
||||
|
@ -16,7 +16,7 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<td rowspan="9">
|
||||
<?= $helper->img($item['anime']['cover_image'], ["width" => "390"]) ?>
|
||||
<?= $helper->img($item['anime']['cover_image']) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -41,7 +41,7 @@ use Aviat\AnimeClient\Kitsu;
|
||||
$rendered[] = $component->media(
|
||||
array_merge([$item['title']], $item['titles']),
|
||||
$url->generate("{$mediaType}.details", ['id' => $item['slug']]),
|
||||
$helper->picture("images/{$mediaType}/{$item['id']}.webp")
|
||||
$helper->img(Kitsu::getPosterImage($item), ['width' => 220, 'loading' => 'lazy']),
|
||||
);
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ use Aviat\AnimeClient\Kitsu;
|
||||
$link = $url->generate('person', ['id' => $c['person']['id']]);
|
||||
?>
|
||||
<a href="<?= $link ?>">
|
||||
<?= $helper->picture(getLocalImg($c['person']['image'], TRUE)) ?>
|
||||
<?= $helper->img($c['person']['image']) ?>
|
||||
<div class="name">
|
||||
<?= $c['person']['name'] ?>
|
||||
</div>
|
||||
@ -91,7 +91,7 @@ use Aviat\AnimeClient\Kitsu;
|
||||
$titles = Kitsu::filterTitles($series['attributes']);
|
||||
?>
|
||||
<a href="<?= $link ?>">
|
||||
<?= $helper->picture(getLocalImg($series['attributes']['posterImage']['small'], TRUE)) ?>
|
||||
<?= $helper->img(Kitsu::getPosterImage($series['attributes'])) ?>
|
||||
</a>
|
||||
<div class="name">
|
||||
<a href="<?= $link ?>">
|
||||
@ -121,12 +121,12 @@ use Aviat\AnimeClient\Kitsu;
|
||||
$person = $component->character(
|
||||
$c['person']['name'],
|
||||
$url->generate('person', ['slug' => $c['person']['slug']]),
|
||||
$helper->picture(getLocalImg($c['person']['image']))
|
||||
$helper->img($c['person']['image']['original']['url']),
|
||||
);
|
||||
$medias = array_map(fn ($series) => $component->media(
|
||||
array_merge([$series['title']], $series['titles']),
|
||||
$url->generate('anime.details', ['id' => $series['slug']]),
|
||||
$helper->picture(getLocalImg($series['posterImage'], TRUE))
|
||||
$helper->img(Kitsu::getPosterImage($series)),
|
||||
), $c['series']);
|
||||
$media = implode('', array_map('mb_trim', $medias));
|
||||
|
||||
|
@ -7,11 +7,9 @@
|
||||
<article class="flex flex-no-wrap flex-justify-start">
|
||||
<section class="flex-self-center history-img">
|
||||
<a href="<?= $item['url'] ?>">
|
||||
<?= $helper->picture(
|
||||
<?= $helper->img(
|
||||
$item['coverImg'],
|
||||
'jpg',
|
||||
['width' => '110px', 'height' => '156px'],
|
||||
['width' => '110px', 'height' => '156px']
|
||||
) ?>
|
||||
</a>
|
||||
</section>
|
||||
|
@ -79,7 +79,7 @@
|
||||
$rendered[] = $component->character(
|
||||
$char['name'],
|
||||
$url->generate('character', ['slug' => $char['slug']]),
|
||||
$helper->picture("images/characters/{$id}.webp"),
|
||||
$helper->img($char['image'], ['loading' => 'lazy']),
|
||||
($role !== 'main') ? 'small-character' : 'character'
|
||||
);
|
||||
}
|
||||
@ -96,7 +96,7 @@
|
||||
fn ($person) => $component->character(
|
||||
$person['name'],
|
||||
$url->generate('person', ['slug' => $person['slug']]),
|
||||
$helper->picture("images/people/{$person['id']}.webp")
|
||||
$helper->img($person['image']),
|
||||
),
|
||||
$people
|
||||
))
|
||||
|
@ -18,7 +18,7 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<td rowspan="9">
|
||||
<?= $helper->image($item['manga']['image'], ["width" => "390"]) ?>
|
||||
<?= $helper->img($item['manga']['image']) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -1,6 +1,3 @@
|
||||
<?php
|
||||
use function Aviat\AnimeClient\getLocalImg;
|
||||
?>
|
||||
<main class="details fixed">
|
||||
<section class="flex flex-no-wrap">
|
||||
<div>
|
||||
@ -40,7 +37,7 @@ use function Aviat\AnimeClient\getLocalImg;
|
||||
<?= $component->media(
|
||||
$series['titles'],
|
||||
$url->generate("{$mediaType}.details", ['id' => $series['slug']]),
|
||||
$helper->img($series['image'], ['width' => 220])
|
||||
$helper->img($series['image'], ['width' => 220, 'loading' => 'lazy'])
|
||||
) ?>
|
||||
<?php endforeach; ?>
|
||||
</section>
|
||||
@ -61,7 +58,7 @@ use function Aviat\AnimeClient\getLocalImg;
|
||||
$character = $component->character(
|
||||
$item['character']['canonicalName'],
|
||||
$url->generate('character', ['slug' => $item['character']['slug']]),
|
||||
$helper->picture(getLocalImg($item['character']['image']['original'] ?? null))
|
||||
$helper->img($item['character']['image'], ['loading' => 'lazy']),
|
||||
);
|
||||
$medias = [];
|
||||
foreach ($item['media'] as $sid => $series)
|
||||
@ -69,7 +66,7 @@ use function Aviat\AnimeClient\getLocalImg;
|
||||
$medias[] = $component->media(
|
||||
$series['titles'],
|
||||
$url->generate('anime.details', ['id' => $series['slug']]),
|
||||
$helper->img($series['image'], ['width' => 220])
|
||||
$helper->img($series['image'], ['width' => 220, 'loading' => 'lazy'])
|
||||
);
|
||||
}
|
||||
$media = implode('', array_map('mb_trim', $medias));
|
||||
|
@ -40,12 +40,10 @@ query ($slug: String!) {
|
||||
}
|
||||
type
|
||||
}
|
||||
voices(first: 100) {
|
||||
role
|
||||
voices(first: 10) {
|
||||
nodes {
|
||||
id
|
||||
licensor {
|
||||
name
|
||||
}
|
||||
locale
|
||||
person {
|
||||
id
|
||||
|
@ -52,7 +52,7 @@ query ($slug: String!) {
|
||||
}
|
||||
}
|
||||
}
|
||||
voices(first: 100) {
|
||||
voices(first: 500) {
|
||||
nodes {
|
||||
locale
|
||||
mediaCharacter {
|
||||
|
@ -59,7 +59,7 @@ final class AnimeTransformer extends AbstractTransformer {
|
||||
|
||||
$details = $rawCharacter['character'];
|
||||
$characters[$type][$details['id']] = [
|
||||
'image' => $details['image'],
|
||||
'image' => $details['image']['original']['url'] ?? '',
|
||||
'name' => $details['names']['canonical'],
|
||||
'slug' => $details['slug'],
|
||||
];
|
||||
@ -103,9 +103,7 @@ final class AnimeTransformer extends AbstractTransformer {
|
||||
$staff[$role][$person['id']] = [
|
||||
'id' => $person['id'],
|
||||
'name' => $name,
|
||||
'image' => [
|
||||
'original' => $person['image']['original']['url'] ?? '',
|
||||
],
|
||||
'image' => $person['image']['original']['url'],
|
||||
'slug' => $person['slug'],
|
||||
];
|
||||
|
||||
|
@ -148,7 +148,7 @@ final class CharacterTransformer extends AbstractTransformer {
|
||||
'slug' => $voiceMap['media']['slug'],
|
||||
'title' => $voiceMap['media']['titles']['canonical'],
|
||||
'titles' => Kitsu::getFilteredTitles($voiceMap['media']['titles']),
|
||||
'posterImage' => $voiceMap['media']['posterImage']['views'][1]['url'],
|
||||
'posterImage' => Kitsu::getPosterImage($voiceMap['media']),
|
||||
];
|
||||
|
||||
uasort($castings['Voice Actor'][$lang][$id]['series'], $titleSort);
|
||||
|
@ -58,7 +58,7 @@ final class MangaTransformer extends AbstractTransformer {
|
||||
|
||||
$details = $rawCharacter['character'];
|
||||
$characters[$type][$details['id']] = [
|
||||
'image' => $details['image'],
|
||||
'image' => $details['image']['original']['url'],
|
||||
'name' => $details['names']['canonical'],
|
||||
'slug' => $details['slug'],
|
||||
];
|
||||
@ -103,9 +103,7 @@ final class MangaTransformer extends AbstractTransformer {
|
||||
'id' => $person['id'],
|
||||
'slug' => $person['slug'],
|
||||
'name' => $name,
|
||||
'image' => [
|
||||
'original' => $person['image']['original']['url'] ?? '',
|
||||
],
|
||||
'image' => $person['image']['original']['url'],
|
||||
];
|
||||
|
||||
usort($staff[$role], fn ($a, $b) => $a['name'] <=> $b['name']);
|
||||
|
@ -106,6 +106,7 @@ final class PersonTransformer extends AbstractTransformer {
|
||||
$media = [
|
||||
'id' => $rawMedia['id'],
|
||||
'slug' => $rawMedia['slug'],
|
||||
'image' => Kitsu::getPosterImage($rawMedia),
|
||||
'titles' => array_merge(
|
||||
[$rawMedia['titles']['canonical']],
|
||||
Kitsu::getFilteredTitles($rawMedia['titles']),
|
||||
@ -123,7 +124,7 @@ final class PersonTransformer extends AbstractTransformer {
|
||||
'character' => [
|
||||
'id' => $character['id'],
|
||||
'slug' => $character['slug'],
|
||||
'image' => Kitsu::getPosterImage($character),
|
||||
'image' => $character['image']['original']['url'],
|
||||
'canonicalName' => $character['names']['canonical'],
|
||||
],
|
||||
'media' => [
|
||||
|
@ -343,7 +343,7 @@ final class Kitsu {
|
||||
* @param int $size
|
||||
* @return string
|
||||
*/
|
||||
public static function getPosterImage(array $base, int $size = 2): string
|
||||
public static function getPosterImage(array $base, int $size = 1): string
|
||||
{
|
||||
$rawUrl = $base['posterImage']['views'][$size]['url']
|
||||
?? $base['posterImage']['original']['url']
|
||||
|
Loading…
Reference in New Issue
Block a user