I needed a page that shows photo for a online photo blog. Putting more then 10 images on the page with markdown can be time consuming, room for human error and the original photo size is displayed, not always handy with the occasional 2mb photos.
I created a template for displaying images that are uploaded to that page in the panel. Controlling the size and compression of the images and the option to add a captions to the image.
Nothing fancy but does the job and suits my learning curve
I hope someone can use this or has a different solution to the same problem.
imagelist.php
<?php snippet('header') ?>
<?= $page->title()->html() ?>
<?= $page->intro()->kirbytext() ?>
<div class="text wrap">
<?php
// get all images in the folder
$images = $page->images();
?>
<div class="image-grid">
<?php foreach($images as $image): ?>
<figure>
<img src="<?= $image->resize(1200, null, 65)->url() ?>" alt="">
<?php
// add caption
$temp = $image->caption();
if($temp != "") : ?>
<figcaption><?php echo $temp->html(); ?></figcaption>
<?php endif; ?>
</figure>
@jimbobrjames Why is it easier with a plugin to fetch all photos of a page? That makes sense if you only want to pick particular photos, not if you want to use all photos.
But the above is not really a special solution, but the standard Kirby way of handling this.
But didn’t that check if the image physically existed before using it? Or does images() already take care of that? It came from the example in the images plugin docs.