Skip to content

Latest commit

 

History

History
executable file
·
37 lines (27 loc) · 2.19 KB

README.md

File metadata and controls

executable file
·
37 lines (27 loc) · 2.19 KB

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:

  • strip default: true - strips metadata from images
  • autoOrient default: false - aplies orientation meta tag if its present (in vips flag --rotate)
  • interlace default: false - generate an interlaced (progressive) jpeg
  • log default: false - There is dumb loging included if you want to debug what is going on and what commands are getting fired
  • logdir default: plugindirectory/logs - connected to above - set where to save logs.

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
  ]
];