@tancrede
I came up with a hack to solve this:
$tags = array_flip(array_diff($tagsLC, $existing)); in your functions.php file: $filename = query_single_row("SELECT filename FROM ".prefix('images')." WHERE id = '".$id."'"); $albumid = query_single_row("SELECT albumid FROM ".prefix('images')." WHERE id = '".$id."'"); $folder = query_single_row("SELECT folder FROM ".prefix('albums')." WHERE id = '".$albumid['albumid']."'"); $iptc = new iptc(SERVERPATH.'/albums/'.$folder['folder'].'/'.$filename['filename']); $iptc->set(IPTC_KEYWORDS,implode('; ',$tags)); $iptc->write();
You might be better off making this a plugin that handles the save_image_custom_data filter. Then you don't have to modify the core files. In addition, the album and image names are redily available to you from this filter, no querys needed.
Also, just a warning to anyone wishing to use this code. There is a function to get the name of the albums folder which should be used. Otherwise if you do not have the "standard" folder name this code will fail.