@tancrede I came up with a hack to solve this: 1. download the "IPTC EASY 1.0" class from the comments on http://us2.php.net/manual/en/function.iptcembed.php 2. Save as iptc.php in the zp-core folder in your zenphoto install 3. add the following code, immediately before the line `$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.
Comments
I came up with a hack to solve this:
1. download the "IPTC EASY 1.0" class from the comments on http://us2.php.net/manual/en/function.iptcembed.php
2. Save as iptc.php in the zp-core folder in your zenphoto install
3. add the following code, immediately before the line `$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();
`
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.