Update user details page to pull images directly from Kitsu

This commit is contained in:
Timothy Warren 2022-01-17 08:58:59 -05:00
parent 02d99c8a43
commit f210b157ff
4 changed files with 10 additions and 5 deletions

View File

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

View File

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

View File

@ -343,7 +343,7 @@ final class Kitsu {
* @param int $size
* @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']
?? $base['posterImage']['original']['url']