floriankarsten / kirby3-vipsthumbnail

Kirby3 vipsthumbnail thumbnail driver
MIT License
11 stars 0 forks source link
kirby-cms kirby3-cms kirby3-plugin

Kirby 3 Vips thumbnail

Highly untested use at your own risk! This is very basic Kirby CMS thumbnail driver for libvips. It uses vipsthumbnail that is installed with vips. You need recent libvips installed on your machine but you don't need Vips-php PECL extension installed this plugin doesn't use it.

Why would you want to use this?

Vips is library similar to Imagemagick but uses much less memory and it's faster. This is especially useful if you are dealing with images in 10000x10000+ px range and need to make thumbnails on memory constrained environments (benchmarks).

Why use ImageMagick or GD

This library is aimed only at resizing and cropping. Kirby's other thumb functions like grayscale, blur won't work. Cropping right now uses vips "smartcrop" algorythm which might be advantage but you can't set cropping by hand (could be easily implemented i just don't have use for it).

Installation

Download and copy this repository to /site/plugins/kirby3-vipsthumbnail

Alternatively, you can install it with composer: composer require floriankarsten/kirby3-vipsthumbnail

Output options

Vips has some options that i don't understand (like trellis-quant, overshoot-deringing, optimize-scans) but these options are currently implemented:

You can set these with normal thumbs kirby config. Kirby options like 'quality' and 'bin' apply.

return [
  'thumbs' => [
    'driver'    => 'vipsthumbnail',
    'quality'   => 90,
    'bin'       => '/usr/local/bin/vipsthumbnail',
    'interlace' => true
  ]
];