I obviously tried this and no luck…
Can someone leads me to the right way to simply add a resize function that triggers when an image is uploaded to the panel other than set a max height/width in the blueprint ?
I don’t get it…
Well with Kirby 2.1.0, it looks like the easiest way to trigger an action based on panel’s behaviour is now to work with a hook.
With the help of the imageconverter plugin (or even SimpleImage) , I’m still struggling to get a resize on upload (stating every file uploaded will be an image, i avoided to get the $file->type().
in site/config/config.php :
kirby()->hook('panel.file.upload', function($file) {
$image = new ImageConverter($file, array(
'height'=>600,
'tosRGB' => false,
'filename' => '{name}_resized.{extension}'
));
$image->process();
});
```
Well this does …nothing.
I don't see any 500 status code returned in the developer tools / network tab on chrome, so I'm guessing the function has been a success .
What can be wrong with this code ?
thanks for any hint / tip / help
Have you set a different path to the ImageMagick ‘convert’ script? - I think that the problem is up to ImageMagick. Now I have tested the code above and it works with 2.1.0.
$kirby->plugins() in index.php is not necessary anymore, when using version 2.1.0.
I think you’re right - I’ve tried with gd as my thumbs driver and simpleimage to process the uploaded file and although no image is processed --which is really unexpected, it looks like my local MAMP install is broken…
Still, on MAMP I’ve setup php 5.5.10 with the extension imagick.so uncommented in the php.ini but this don’t work any better.
Will try on remote host and doublecheck the install
Thanks for your help
—> Yes, shitty local install confirmed as it works like a charm on a well-configured server