Reference

Guide

Thumbs

Add your own thumb generator

If you are not happy with our built-in thumb generators, you can create your own.

/site/plugins/thumbs/index.php
Kirby::plugin('my/thumbs', [
    'components' => [
        'thumb' => function (App $kirby, string $src, string $dst, array $options) {
            $rootToThumb = myThumbGenerator($src, $dst, $options);

            return $rootToThumb;
        }
    ]
]);

Parameters

Name Type Default Description
$kirby Kirby\Cms\App

Kirby instance

$src string

The root of the original file

$dst string

The root to the desired destination

$options array

All thumb options that should be applied: width, height, crop, blur, grayscale

Return type

string

Source code

kirby/config/components.php#L208