Hi there. I’m using Kirby to display a large amount of images in a gallery (similar to Flickr), but it seems something broke with the 2.3.1 update, and I’m not shure where exactly the problem is. Basically, I want to serve compressed and resized thumbnails for as many screen resolutions as possible. The gallery plugin I’m using can automatically load the best available thumbnail, as long as they all have a certain suffix, so up until now I’ve just pre-generated the thumbnails with a hook like this:
kirby()->hook('panel.file.upload', function($file) {
$imageconvert1 = new thumb($file, array('width' => 320, 'height' => 320, 'filename' => '{safeName}-320.{extension}'));
$imageconvert2 = new thumb($file, array('width' => 640, 'height' => 640, 'filename' => '{safeName}-640.{extension}'));
$imageconvert3 = new thumb($file, array('width' => 800, 'height' => 800, 'filename' => '{safeName}-800.{extension}'));
$imageconvert4 = new thumb($file, array('width' => 1024, 'height' => 1024, 'filename' => '{safeName}-1024.{extension}'));
$imageconvert5 = new thumb($file, array('width' => 1600, 'height' => 1600, 'filename' => '{safeName}-1600.{extension}'));
$imageconvert6 = new thumb($file, array('width' => 1920, 'height' => 1920, 'filename' => '{safeName}-1920.{extension}'));
$imageconvert7 = new thumb($file, array('width' => 2048, 'height' => 2048, 'filename' => '{safeName}-2048.{extension}'));
});
And then frankensteined the URL together like this (I’m shure there’s a better/cleaner way to do this, but my PHP knowledge is limited):
<img src="<?php echo kirby()->urls()->content() ?>/<?php echo $screenshot->page()->diruri() ?>/thumbs/<?php echo $screenshot->name()?>-640.<?php echo $screenshot->extension()?>" itemprop="thumbnail" alt="<?php echo $screenshot->title() ?>">
This used to work fine, but as mentioned, the 2.3.1 update broke the thumbnail creation, uploading an image doesn’t generate anything anymore. I’ve tried to remove the “new” before “thumb”, which seems to fix the problem, until I upload a second picture and all previously generated thumbnails get deleted (another person seems to have the same problem).
I’m not shure if this is a bug or if I need to update my code to work with the new API, either way I have no clue how to fix this. What can I do? Is there another solution I can try? I’ve read something on GitHub about a versions feature, but it doesn’t seem like it’s implemented yet. Any help would be greatly appreciated.