Several images are not visible on the templates page(album.php).
Is there something wrong with my code?
templates/album.php
<?php if ($page->spreadimagestype() == 'onebtn'): ?>
<?php foreach ($page->spreadimages()->toFiles() as $spreadimages): ?>
<figure class="single-image-box">
<img class="lazy" src="<?= $spreadimages->resize(null, 100)->url() ?>" data-src="<?= $spreadimages->resize(null, 1024)->url() ?>">
<a class="single-isbn" href="<?= $page->isbnurl() ?>" target="_blank">ISBN <?= $page->isbn() ?></a>
</figure>
<?php endforeach ?>
<?php endif ?>
blueprints/pages/album.yml
tabs:
onepage:
label: μ€λͺ
Description
icon: text
columns:
- width: 1/1
fields:
spreadimagestype:
type: radio
default: onebtn
options:
onebtn: Show
twobtn: Hide
spreadimages:
type: files
layout: cards
template: image
uploads: false
info: "{{ file.dimensions }}"
image:
ratio: 5/4
cover: true
models/album.php
<?php
class AlbumPage extends Page
{
public function cover()
{
return $this->content()->get('cover')->toFile() ?? $this->image();
}
public function spreadimages()
{
return $this->content()->get('spreadimages')->toFile() ?? $this->image();
}
}