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
*.db
*.sqlite3
apidocs/*
apidocs/**
tests/test_data/sessions/*
cache.properties
build/**
@ -27,5 +27,6 @@ phinx.yml
Caddyfile
build/humbuglog.txt
public/images/anime/**
public/images/avatars/**
public/images/manga/**
public/images/characters/**

View File

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

View File

View File

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