coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: spiros71 on December 25, 2007, 02:28:58 PM

Title: Import IPTC data to corresponding cpg categories
Post by: spiros71 on December 25, 2007, 02:28:58 PM
I have images with IPTC fields and I want them to be imported as coppermine fields. For example:

IPTC keywords: import to coppermine keywords
IPTC object name: import to coppermine image title
IPTC caption: import to coppermine image description

I tried it but it did not import anything.

http://www.translatum.gr/gallery/index.php
Title: Re: Import IPTC data to corresponding cpg categories
Post by: spiros71 on December 25, 2007, 02:39:59 PM
I tried again with enabled IPTC and it imported them but did not import the Greek letters:

i.e. IPTC keywords in pic were:
Βάρκες - Boats, Αφαιρετική - Abstract, Θάλασσα - Sea

And it imported
- Abstract, Θάλασσα - Sea
Title: Re: Import IPTC data to corresponding cpg categories
Post by: Joachim Müller on December 25, 2007, 03:09:40 PM
Known issue: IPTC doesn't support uft-8
Title: Re: Import IPTC data to corresponding cpg categories
Post by: spiros71 on December 25, 2007, 04:19:16 PM
Does this mean that if my coppermine encoding was Windows-1253 for example, Greek would be displayed correctly?

I also have a txt export of the images with the metadata in ASCII format. Would this help in importing them?
Title: Re: Import IPTC data to corresponding cpg categories
Post by: lamama on December 26, 2007, 09:42:48 PM
Maybe you can modify CPG to read 'your' IPTC-tags... I've done something similar (?) for german umlauts (üäö etc.).

Take picmgmt.inc.php, search for function add_picture.

search for:
           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(' ',$iptc['Keywords']) : $keywords;


add after:
               $title  = utf8_encode(html_entity_decode($title, ENT_NOQUOTES));
               $caption = utf8_encode(html_entity_decode($caption, ENT_NOQUOTES));
               $keywords = utf8_encode(html_entity_decode($keywords, ENT_NOQUOTES));               


It works...

a) ... if your IPTC-'special characters' are encoded as html-entities. I don't know if that's the case with your pics. If it won't work, you maybe just have to change/replace the php-functions (like html_entity_decode) accordingly to en/decode them correctly. For me (german umlauts) it works with IPTC-Data written by www.xnview.com.

b) ... only with newly added pics. To reload the IPTC-Data of existing pics to the CPG database I've done another quick&dirty hack (http://forum.coppermine-gallery.net/index.php?topic=43486.msg234753#msg234753) that 'enhances' the "Reload file dimensions and size information"-admin tool to reload the IPTC-Data as well.

Maybe it's helpful, maybe it's not  ;)
Title: Re: Import IPTC data to corresponding cpg categories
Post by: spiros71 on December 29, 2007, 01:38:20 AM
Hi lamama,

Thanks for your kind help! I tried it, but still skips the Greek. The program originally used for photo management was fotostation pro.
http://www.fotoware.com/Products/FotoStationPro/FeatureOverview.aspx

You can see one of the pics I used here
http://www.translatum.gr/gallery/displayimage-lastup-0-0.html
Title: Re: Import IPTC data to corresponding cpg categories
Post by: Joachim Müller on December 29, 2007, 11:16:55 AM
You're using cpg1.4.5, while the most recent stable release currently is cpg1.4.14, so you're running 9 (!!) versions behind. It is absolutely mandatory to upgrade asap no matter what!