Uploaded images have wrong EXIF rotation

I’ve made a few sites with Kirby, and just now I’ve stumbled acros this problem. When I upload new pictures, they show up wrong when they include an EXIF rotation tag. Is there a way of getting Kirby to rotate the pictures correctly (and stripping the EXIF data?) after uploading them?

I’ve found this : Auto rotate and remove EXIF

But I have no idea how to implement this with the following PHP script : http://stackoverflow.com/questions/7489742/php-read-exif-data-and-adjust-orientation

I’ve tested the EXIF rotation with these images : https://github.com/recurser/exif-orientation-examples

Or is there an easier solution? (knowing the things I’ve seen in this forum, there might be a one line solution to this :wink: ) Any help would be more than welcome right now.

You can use a panel.file.upload and panel.file.replace hook: https://getkirby.com/docs/developer-guide/advanced/hooks