Announcement

  •  » Extensions
  •  » Remove keywords from photo on when sychronizing

#1 2020-05-15 23:17:26

hackerman
Member
2020-05-15
3

Remove keywords from photo on when sychronizing

Hello/Hi/Greetings,

I've built a plugin that reads in metadata from a sidecar file. It's a very simple function, I've added a function to the event `format_exif_data` that basically adds additional key / value pairs to the array. One of these are `xmp_keywords` which I'm pairing in my config for Piwigo to map them to keywords:

// use_exif_mapping: same behaviour as use_iptc_mapping
$conf['use_exif_mapping'] = array(
  'date_creation' => 'DateTimeOriginal',
  'keywords' => 'xmp_keywords',
  );

This is working great - new keywords come in for a photo and are created by Piwigo and associated to that image. My question is that when a keyword gets removed from the photo and I synchronize the album, that function runs and returns the data without that keyword, but Piwigo doesn't remove that keyword from the photo in its database. Is there a way I can have my plugin remove keywords that are no longer included in this list?

Thanks!

Piwigo version: 2.10.2
PHP version: 7.3.17
MySQL version: mysql  Ver 15.1 Distrib 10.4.12-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
Piwigo URL: locally hosted

Offline

 

#2 2020-05-16 07:31:58

ddtddt
Piwigo Team
Quetigny - France
2007-07-27
6999

Re: Remove keywords from photo on when sychronizing

Hi :-)

code your plugin ?


You love Piwigo so don't hesitate to participate, learn more on the "Contribute to Piwigo" page. If you don't have much time for contribution, you can also help the project with a donation.

Offline

 

#3 2020-05-16 15:29:44

hackerman
Member
2020-05-15
3

Re: Remove keywords from photo on when sychronizing

It's a work in progress. I'm currently trying to keep 'keywords' to be in sync. But you can find what I've got so far here: https://github.com/alex-phillips/piwigo … car-plugin

Offline

 

#4 2020-05-16 15:34:57

hackerman
Member
2020-05-15
3

Re: Remove keywords from photo on when sychronizing

Is there a different event I should do this work in? Or another one I should tie into? I can't seem to find a list of available events in the docs, so not sure what I can use. Is there a 'handle_metadata_before_write' event or something?

Offline

 
  •  » Extensions
  •  » Remove keywords from photo on when sychronizing

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2021 · Contact