Which image processor plays nice with Kirby?

To serve optimised images on the frontend I like to use an image processor on the server which optimises images on the fly for the visitor.
Because I’m just starting out with Kirby I am curious if you guys have suggestions for PHP image processors which play nice with Kirby.

Another flat-file CMS Statamic uses Glide to serve images. Perhaps I’m wrong but Kirby doesn’t have something similar? I noticed the “Ratio” and “Crop” options in the image blueprint but am not sure if that’s hooked up…


Kirby has $file->crop() and $file->resize() functions to process your images in your templates.

You can also detect an image uploads in the config file with a hook (file.create:before) and resize the image programmatically if for instance its weight is more than 1 mega.

Checking the reference I can see that the $file->resize() can resize based on width and height, but I like to show the same image but smaller in file-size instead. Or do I miss some other function, like “jpeg-quality=80%”?

You can also set the quality in %, either in the function call or as a preset.

Thanks all! So I don’t need any third party image processor at all? That’s neat.

It’s what we call “The Kirby way of life” :wink:

1 Like

I am using layout and blocks to render the content; using a snippet I render <?= $column->blocks() ?> in which can be text or an image. Do I need to create yet another snippet for the image to use the size-function?

(still a noob concerning Kirby :slight_smile: )

You can overwrite the native image block of Kirby to add your own resize process.

Nice! I just worked my way half through the youtube videos of Kirby and especially https://www.youtube.com/watch?v=op5iP71Bg6w the one with the projects grid of images was clarifying!