Get images from proxy or cache for Manga views, and Add views

This commit is contained in:
Timothy Warren 2017-04-13 11:44:03 -04:00
parent 1c06748232
commit 029073a4ea
7 changed files with 14 additions and 10 deletions

View File

@ -17,7 +17,7 @@
<?php /* <button class="plus_one_volume">+1 Volume</button> */ ?>
</div>
<?php endif ?>
<img src="<?= $escape->attr($item['manga']['image']) ?>" />
<img src="<?= $urlGenerator->assetUrl('images/manga', "{$item['manga']['id']}.jpg") ?>" />
<div class="name">
<a href="<?= $url->generate('manga.details', ['id' => $item['manga']['slug']]) ?>">
<?= $escape->html(array_shift($item['manga']['titles'])) ?>

View File

@ -1,7 +1,7 @@
<main class="details fixed">
<section class="flex flex-no-wrap">
<div>
<img class="cover" src="<?= $data['cover_image'] ?>" alt="<?= $data['title'] ?> cover image" />
<img class="cover" src="<?= $urlGenerator->assetUrl('images/manga', "{$data['id']}.jpg") ?>" alt="<?= $data['title'] ?> cover image" />
<br />
<br />
<table>
@ -39,7 +39,7 @@
<?php if (count($characters) > 0): ?>
<h2>Characters</h2>
<section class="media-wrap">
<?php foreach($characters as $char): ?>
<?php foreach($characters as $id => $char): ?>
<?php if ( ! empty($char['image']['original'])): ?>
<article class="character">
<?php $link = $url->generate('character', ['slug' => $char['slug']]) ?>
@ -47,7 +47,7 @@
<?= $helper->a($link, $char['name']); ?>
</div>
<a href="<?= $link ?>">
<?= $helper->img($char['image']['original'], [
<?= $helper->img($urlGenerator->assetUrl('images/characters', "{$id}.jpg"), [
'width' => '225'
]) ?>
</a>

View File

@ -15,7 +15,7 @@
</th>
<th>
<article class="media">
<?= $helper->img($item['manga']['image']); ?>
<?= $helper->img($urlGenerator->assetUrl('images/manga', "{$item['manga']['id']}.jpg")); ?>
</article>
</th>
</tr>

View File

@ -1,8 +1,9 @@
{{#data}}
<article class="media search">
<div class="name" style="background-image:url({{attributes.posterImage.small}})">
<div class="name">
<input type="radio" class="big-check" id="{{attributes.slug}}" name="id" value="{{id}}" />
<label for="{{attributes.slug}}">
<img src="/public/images/anime/{{id}}.jpg" alt="" width="220" />
<span class="name">
{{attributes.canonicalTitle}}
<br />

View File

@ -1,8 +1,9 @@
{{#data}}
<article class="media search">
<div class="name" style="background-image:url({{attributes.posterImage.small}})">
<div class="name">
<input type="radio" class="big-check" id="{{attributes.slug}}" name="id" value="{{id}}" />
<label for="{{attributes.slug}}">
<img src="/public/images/manga/{{id}}.jpg" alt="" width="220" />
<span class="name">
{{attributes.canonicalTitle}}
<br />

View File

@ -84,6 +84,7 @@ class MangaListTransformer extends AbstractTransformer {
'total' => $totalVolumes
],
'manga' => [
'id' => $mangaId,
'titles' => Kitsu::filterTitles($manga),
'alternate_title' => NULL,
'slug' => $manga['slug'],

View File

@ -33,7 +33,7 @@ class MangaTransformer extends AbstractTransformer {
public function transform($item)
{
$genres = [];
foreach($item['included'] as $included)
{
if ($included['type'] === 'genres')
@ -41,10 +41,11 @@ class MangaTransformer extends AbstractTransformer {
$genres[] = $included['attributes']['name'];
}
}
sort($genres);
return [
'id' => $item['id'],
'title' => $item['canonicalTitle'],
'en_title' => $item['titles']['en'],
'jp_title' => $item['titles']['en_jp'],