Version 5.1 - All the GraphQL #32

Closed
timw4mail wants to merge 1160 commits from develop into master
4 changed files with 10 additions and 5 deletions
Showing only changes of commit f210b157ff - Show all commits

View File

@ -16,7 +16,7 @@ use Aviat\AnimeClient\Kitsu;
<section class="flex flex-no-wrap"> <section class="flex flex-no-wrap">
<aside class="info"> <aside class="info">
<center> <center>
<?= $helper->img($urlGenerator->assetUrl($data['avatar']), ['alt' => '']); ?> <?= $helper->img($data['avatar'], ['alt' => '']); ?>
</center> </center>
<br /> <br />
<table class="media-details"> <table class="media-details">
@ -75,7 +75,7 @@ use Aviat\AnimeClient\Kitsu;
$rendered[] = $component->character( $rendered[] = $component->character(
$item['names']['canonical'], $item['names']['canonical'],
$url->generate('character', ['slug' => $item['slug']]), $url->generate('character', ['slug' => $item['slug']]),
$helper->picture("images/characters/{$item['id']}.webp") $helper->img($item['image']['original']['url'])
); );
} }
else else
@ -86,7 +86,7 @@ use Aviat\AnimeClient\Kitsu;
Kitsu::getFilteredTitles($item['titles']), Kitsu::getFilteredTitles($item['titles']),
), ),
$url->generate("{$type}.details", ['id' => $item['slug']]), $url->generate("{$type}.details", ['id' => $item['slug']]),
$helper->picture("images/{$type}/{$item['id']}.webp"), $helper->img(Kitsu::getPosterImage($item), ['width' => 220]),
); );
} }
} }

View File

@ -102,6 +102,11 @@ query ($slug: String!) {
original { original {
url url
} }
views {
url
height
width
}
} }
names { names {
alternatives alternatives

View File

@ -42,7 +42,7 @@ final class UserTransformer extends AbstractTransformer {
return User::from([ return User::from([
'about' => $base['about'], 'about' => $base['about'],
'avatar' => getLocalImg($base['avatarImage']['original']['url'], FALSE), 'avatar' => $base['avatarImage']['original']['url'],
'favorites' => $this->organizeFavorites($favorites), 'favorites' => $this->organizeFavorites($favorites),
'location' => $base['location'], 'location' => $base['location'],
'name' => $base['name'], 'name' => $base['name'],

View File

@ -343,7 +343,7 @@ final class Kitsu {
* @param int $size * @param int $size
* @return string * @return string
*/ */
public static function getPosterImage(array $base, int $size = 1): string public static function getPosterImage(array $base, int $size = 2): string
{ {
$rawUrl = $base['posterImage']['views'][$size]['url'] $rawUrl = $base['posterImage']['views'][$size]['url']
?? $base['posterImage']['original']['url'] ?? $base['posterImage']['original']['url']