danst0
1
Hi,
is there a Kirby way to auto-rotate an uploaded image (see also) and remove selected exif-information?
Daniel
Update: I found the required command to strip selected exif-data from a folder.
exiftool -geotag= foo.jpg
or
exiftool -geotag= -r FOLDERNAME
How would I execute this command on all images as soon as I change status to visible?
danst0
3
When is this hook called? I am not sorting anything?
The sort hook is called when a page is sorted and when a page is made visible (i.e. make visible = sort)
danst0
5
Great, this is what I came up with:
kirby()->hook('panel.page.sort', function($page) {
//base_dir = '/var/www/ge/content/';
$files = glob('/var/www/ge/content/' . $page->diruri() . '/*.{jpg,jpeg,JPG,JPEG}', GLOB_BRACE);
foreach($files as $file) {
exec ('/usr/bin/exiftool -overwrite_original -P -geotag= ' . $file);
}
});
Is there a better way to put the base_dir in?
You can get the root of the content folder like this:
<?php echo kirby()->urls()->content() ?>
But you might just as well use $page->files()
and with a filter.