pstaender / high-quality-low-size-image-for-kirby
Converts images to low file size high quality images in webp and avif
Installs: 30
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 0
Open Issues: 0
Type:kirby-plugin
Requires
- getkirby/cms: ^4
- getkirby/composer-installer: ^1.1
README
Install
$ composer require pstaender/high-quality-low-size-image-for-kirby
Usage
<?= $page->someImage()->toFile()->highQualityLowSize() ?>
Now your image will be a webp or avif instead of jpg/png/etc 🚀
Webp will be the format if gdlib is available, avif if imagemagick is enabled via thumb driver.
It also checks that the browser supports webp and avif via the accept header and returns the original file if not supported.
Optional: Image Tag
To use it also in kirby text (via image tag) set in config.php
:
[ 'high_quality_and_low_size_image' => [ 'image_tag' => true, ], ]
You can exclude specific image formats from encoding, by default gif
, webp
and avif
are excluded. To set your own rules or to simply force re-encoding every file (by defining an empty array), set the values here:
[ 'high_quality_and_low_size_image' => [ 'excluded_image_formats' => [ // 'avif', 'webp', … ], ], ]
License
MIT