Skip to content

Instantly share code, notes, and snippets.

@samnabi
samnabi / config.php
Created February 1, 2016 18:41
Kirby v2: Shrink large images on upload
<?php
// Copy this code into your config.php file
// Replace the default $maxDimension to meet your needs
// Read more about Kirby's Panel hooks at https://getkirby.com/docs/panel/developers/hooks
// Shrink large images on upload
kirby()->hook('panel.file.upload', 'shrinkImage');
kirby()->hook('panel.file.replace', 'shrinkImage');
function shrinkImage($file, $maxDimension = 1000) {