This plugin for Kirby 2 allows you to convert your images to rgb and resize them down for web use.
It is based on the Thumb class of the Kirby Toolkit.
License: GNU GPL v3.0
- Imagemagick
- php
exec
must be allowed
This plugin doesn't work with GDLib.
Use one of the alternatives below.
If you are using the Kirby CLI you can install this plugin by running the following commands in your shell:
$ cd path/to/kirby
$ kirby plugin:install madergrafisch/kirby-imageconverter
- Clone or download this repository.
- Unzip the archive if needed and rename the folder to
kirby-imageconverter
.
Make sure that the plugin folder structure looks like this:
site/plugins/kirby-imageconverter/
Use kirby 2 panel upload hook to process images on file upload.
kirby()->hook('panel.file.upload', function($file) {
if ($file->type() == 'image') {
mgf\ImageConverter::convert($file, array(
'width' => 1024,
'height' => 1024,
'tosRGB' => true,
));
}
});
Create a new ImageConverter Object by passing a Media Object and some params.
mgf\ImageConverter::convert($image);
This uses the default options, like below.
mgf\ImageConverter::convert($image, array(
'width' => 1024,
'height' => 1024,
'tosRGB' => true,
));
This converts your image to a maximum size of 1024x1024 px and converts its colorspace to sRGB.
mgf\ImageConverter::convert($image, array(
'destination' => '{name}_resized.{extension}',
));
This creates a new image in the same destination, as the original image and adds the suffix '_resized' to the filename.
The class offers some options, most of them by the Kirby Thumb Class.
'destination' => '{name}.{extension}'
'url' => null
'root' => null
'quality' => 100
'blur' => false
'blurpx' => 10
'width' => null
'height' => null
'upscale' => false
'crop' => false
'grayscale' => false
'tosRGB' => false
'autoOrient' => false
'interlace' => false
- Christian Zehetner - Author
- Bastian Allgeier - Author of Kirby Thumbs plugin