In Kirby 2, I created a little plugin that handled file uploads/replacements by: resizing them and converting them to JPEG. (It involved creating a thumb()
version on 'panel.file.upload'
and panel.file.replace'
and then moving files around (including the metadata text file) and deleting the original.)
I’m trying figure out how to adapt this in the new Kirby 3 hook system, and not really sure what the best approach would be.
It would seem to make the most sense to do this in the file.create:before
hook, but it doesn’t seem like I can actually modify the Kirby\Cms\File
object to actually make that happen.
If I use file.create:after
, I suppose I could immediately delete the uploaded file and then “create” the new file. But this seems very hacky and the wrong approach.
Any suggestions on how to approach this? Or, do you know of a plugin that already does this?