I am trying to figure out how to populate a custom user field from the IPTC data embedded in an image. I have named a custom field to be "Photographer" and want to pull the data from IPTC field Name Copyright Notice (defined in iptc.inc.php on this line: "Copyright" => $iptc["2#116"][0], # Max 128 octets, non-repeatable, alphanumeric
.
I tried modifying picmgmt.inc.php to include the following:
if ($CONFIG['read_iptc_data']) {
$iptc = get_IPTC($image);
if (is_array($iptc) && !$title && !$caption && !$keywords && !$copyright) { //if any of those 3
are filled out we don't want to override them, they may be blank on purpose.
$title = (isset($iptc['Headline'])) ? $iptc['Headline'] : $title;
$caption = (isset($iptc['Caption'])) ? $iptc['Caption'] : $caption;
$keywords = (isset($iptc['Keywords'])) ? implode(' ',$iptc['Keywords']) : $keywords;
$copyright = (isset($iptc['Copyright'])) ? $iptc['Copyright'] : $copyright;
}
}
and then set user2 a few lines down in that file as follows:
$CURRENT_PIC_DATA['user1'] = $user1;
$CURRENT_PIC_DATA['user2'] = $copyright;
$CURRENT_PIC_DATA['user3'] = $user3;
$CURRENT_PIC_DATA['user4'] = $user4;
And of course it doesn't work ::). Can anyone take a look and see what I am missing and/or what I messed up in the code, or if there are mods I need to make in another file?
Thanks,
Jason
Well the code I posted earlier does work for batch uploads, just not single uploads. Not thinking, I was testing with singles all along, just tried a batch and it worked just the way I wanted. I am guessing I need to make changes in upload.php, someone please jump in if I am on the wrong track.
Thanks, Jason