Version 5.1 - All the GraphQL #32

Closed
timw4mail wants to merge 1160 commits from develop into master
4 changed files with 17 additions and 9 deletions
Showing only changes of commit 1df71121eb - Show all commits

3
.gitignore vendored
View File

@ -13,7 +13,7 @@ composer.lock
*.sqlite *.sqlite
*.db *.db
*.sqlite3 *.sqlite3
apidocs/* apidocs/**
tests/test_data/sessions/* tests/test_data/sessions/*
cache.properties cache.properties
build/** build/**
@ -27,5 +27,6 @@ phinx.yml
Caddyfile Caddyfile
build/humbuglog.txt build/humbuglog.txt
public/images/anime/** public/images/anime/**
public/images/avatars/**
public/images/manga/** public/images/manga/**
public/images/characters/** public/images/characters/**

View File

@ -9,7 +9,12 @@
<?= $attributes['name'] ?> <?= $attributes['name'] ?>
</a> </a>
</h2> </h2>
<img src="<?= $attributes['avatar']['original'] ?>" alt="" /> <?php
$file = basename(parse_url($attributes['avatar']['original'], \PHP_URL_PATH));
$parts = explode('.', $file);
$ext = end($parts);
?>
<img src="<?= $urlGenerator->assetUrl('images/avatars', "{$data['id']}.{$ext}") ?>" alt="" />
</center> </center>
<br /> <br />
<br /> <br />
@ -65,13 +70,13 @@
<?php if ( ! empty($favorites['characters'])): ?> <?php if ( ! empty($favorites['characters'])): ?>
<h4>Favorite Characters</h4> <h4>Favorite Characters</h4>
<section class="media-wrap"> <section class="media-wrap">
<?php foreach($favorites['characters'] as $char): ?> <?php foreach($favorites['characters'] as $id => $char): ?>
<?php if ( ! empty($char['image']['original'])): ?> <?php if ( ! empty($char['image']['original'])): ?>
<article class="small_character"> <article class="small_character">
<?php $link = $url->generate('character', ['slug' => $char['slug']]) ?> <?php $link = $url->generate('character', ['slug' => $char['slug']]) ?>
<div class="name"><?= $helper->a($link, $char['name']); ?></div> <div class="name"><?= $helper->a($link, $char['name']); ?></div>
<a href="<?= $link ?>"> <a href="<?= $link ?>">
<?= $helper->img($char['image']['original']) ?> <?= $helper->img($urlGenerator->assetUrl('images/characters', "{$char['id']}.jpg")) ?>
</a> </a>
</article> </article>
<?php endif ?> <?php endif ?>
@ -88,7 +93,7 @@
$titles = Kitsu::filterTitles($anime); $titles = Kitsu::filterTitles($anime);
?> ?>
<a href="<?= $link ?>"> <a href="<?= $link ?>">
<img src="<?= $anime['posterImage']['small'] ?>" width="220" alt="" /> <img src="<?= $urlGenerator->assetUrl('images/anime', "{$anime['id']}.jpg") ?>" width="220" alt="" />
</a> </a>
<div class="name"> <div class="name">
<a href="<?= $link ?>"> <a href="<?= $link ?>">
@ -112,7 +117,7 @@
$titles = Kitsu::filterTitles($manga); $titles = Kitsu::filterTitles($manga);
?> ?>
<a href="<?= $link ?>"> <a href="<?= $link ?>">
<img src="<?= $manga['posterImage']['small'] ?>" width="220" alt="" /> <img src="<?= $urlGenerator->assetUrl('images/manga', "{$manga['id']}.jpg") ?>" width="220" alt="" />
</a> </a>
<div class="name"> <div class="name">
<a href="<?= $link ?>"> <a href="<?= $link ?>">

View File

View File

@ -134,6 +134,10 @@ class Index extends BaseController {
$kitsuUrl .= "anime/poster_images/{$id}/small.{$ext}"; $kitsuUrl .= "anime/poster_images/{$id}/small.{$ext}";
break; break;
case 'avatars':
$kitsuUrl .= "users/avatars/{$id}/original.{$ext}";
break;
case 'manga': case 'manga':
$kitsuUrl .= "manga/poster_images/{$id}/small.{$ext}"; $kitsuUrl .= "manga/poster_images/{$id}/small.{$ext}";
break; break;
@ -164,8 +168,6 @@ class Index extends BaseController {
unset($rawfavorites['data']); unset($rawfavorites['data']);
// dump($rawfavorites);
foreach($rawfavorites as $item) foreach($rawfavorites as $item)
{ {
$rank = $item['attributes']['favRank']; $rank = $item['attributes']['favRank'];
@ -174,7 +176,7 @@ class Index extends BaseController {
$output[$key] = $output[$key] ?? []; $output[$key] = $output[$key] ?? [];
foreach ($fav as $id => $data) foreach ($fav as $id => $data)
{ {
$output[$key][$rank] = $data['attributes']; $output[$key][$rank] = array_merge(['id' => $id], $data['attributes']);
} }
} }