forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: philippefx on September 21, 2010, 04:31:38 pm

Title: reading IPTC informations
Post by: philippefx on September 21, 2010, 04:31:38 pm
Hello,

Gallery http://photo.grangeneuve.ch/ (not mandatory : user's login "test", passwd "testforum")

If I enter some common IPTC data (with a software like IrfanView and its IPTC plugin, for example), it works. I can then go in "admin" mode, menu File, Albums, Edit, File Edit, and I can read my IPTC data like title, description, keywords, etc.

This data (title, description, keywords) are also directly used when importing new images.

Now I would like that Coppermine import, or used somewhere, one of this IPTC tag : Copyright, Credits or Source (hey, there is no "author" tag ? ...)

How can I do that ?


Thanks a lot,

Philippe
Title: Re: reading IPTC informations
Post by: Αndré on September 27, 2010, 04:43:55 pm
This data (title, description, keywords) are also directly used when importing new images.
Here is the appropriate code:
Code: (include/picmgmt.inc.php) [Select]
        if ($CONFIG['read_iptc_data']) {
            // read IPTC data
            $iptc = get_IPTC($image);
            if (is_array($iptc) && !$title && !$caption && !$keywords) {  //if any of those 3 are filled out we don't want to override them, they may be blank on purpose.
                $title = (isset($iptc['Title'])) ? $iptc['Title'] : $title;
                $caption = (isset($iptc['Caption'])) ? $iptc['Caption'] : $caption;
                $keywords = (isset($iptc['Keywords'])) ? implode($CONFIG['keyword_separator'], $iptc['Keywords']) : $keywords;
            }
        }

Can you please attach a picture with IPTC data so I can perform some tests?
Title: Re: reading IPTC informations
Post by: philippefx on October 11, 2010, 05:24:51 pm
Hello André,

Thanks for your reply. It seems it goes in the direction of coding changes and I don't want to do there (not enough time to test/maintain/etc.), I prefer to stay with config changes and no more.

I will mark the thread as "Solved", is it ok for you ?

In any case, I send you a photo with IPTC data in it. IPTC fileds like "Copyright", "Byline", Source", and some other are filled.


Thanks,
Philippe
Title: Re: reading IPTC informations
Post by: Αndré on October 12, 2010, 01:54:06 pm
The code changes are very simple. The question is where do you want to store that additional data? Coppermine can store individual data as title, description and keywords. If you want to replace some IPTC fields with other ones, e.g. use the IPTC copyright as description, you'll just have to change
Code: [Select]
$caption = (isset($iptc['Caption'])) ? $iptc['Caption'] : $caption;to
Code: [Select]
$caption = (isset($iptc['Copyright'])) ? $iptc['Copyright'] : $caption;
Title: Re: reading IPTC informations
Post by: philippefx on October 12, 2010, 02:04:23 pm
The code changes are very simple. The question is where do you want to store that additional data? Coppermine can store individual data as title, description and keywords. If you want to replace some IPTC fields with other ones, e.g. use the IPTC copyright as description, you'll just have to change
Code: [Select]
$caption = (isset($iptc['Caption'])) ? $iptc['Caption'] : $caption;to
Code: [Select]
$caption = (isset($iptc['Copyright'])) ? $iptc['Copyright'] : $caption;

And it works :) I tried it, but we need all this tags (title/descr/keyword). Thus it would be more complicated to add fields in the Coppermine's GUI (or inside the DB, etc.).
Using the "five optionnal fileds" is maybe a solution, but we choosed to add the author's name in the description fields and it's ok for us. "Simple is beautifull" :p
Title: Re: reading IPTC informations
Post by: Αndré on October 12, 2010, 02:09:01 pm
You could also concatenate different IPTC data and add it to just one Coppermine field (e.g. add the caption, copyright and source to Coppermine's description field, maybe with a line break). That's just an idea and I'm sure you'll find the best solution for your gallery :)
Title: Re: reading IPTC informations
Post by: philippefx on October 12, 2010, 02:13:57 pm
You could also concatenate different IPTC data and add it to just one Coppermine field (e.g. add the caption, copyright and source to Coppermine's description field, maybe with a line break). That's just an idea and I'm sure you'll find the best solution for your gallery :)

mhhh "just an idea" but it's a *very* good idea. The IPTC data stay clean and Coppermine get the right informations.
*Thanks* :))