IPTC Keyword phrases

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Yoeld
Forum Newbie
Posts: 2
Joined: Sun Nov 14, 2010 2:54 am

IPTC Keyword phrases

Post by Yoeld »

Hello,

I am trying to extract from JPEG file the IPTC medatada. I have no problem doing that except with the Keywords field
If am referring to the tag 2#025:
I am using the code:

Code: Select all

for ($i=0; $i<$keywordcount; $i++) $keywords .= $iptc["2#025"][$i] . ",";
When I have single word keywords, then I have no problem: Italy, Greece, Belgium ... . But when I am having keyword phrases, like "The Netherlands", "United States", or "Pacific Ocean", then the extraction does not keep the phrases. I will get an list of arrays like:
[0]: Netherlands
[1]: United
[2]: The
[3]: States

etc... with no real control on the order of the elements.

Any suggestion what to do to keep the phrases as their orgin?

Thanks, Yoel
User avatar
saltwine
Forum Newbie
Posts: 16
Joined: Tue Nov 09, 2010 7:05 am
Location: London

Re: IPTC Keyword phrases

Post by saltwine »

Hi Yoeld


If the keyword phrases have been stored in the array as separate elements, then there may not be a way to extract them out in their original format. Can we see the output of:

Code: Select all

<?php var_dump($iptc["2#025"]); ?>
... to be sure?
Yoeld
Forum Newbie
Posts: 2
Joined: Sun Nov 14, 2010 2:54 am

Re: IPTC Keyword phrases

Post by Yoeld »

Yes. With the var_dump, you will see single elements. That is exactly the problem.

I suspect it is a limitation of the php function iptcparse. Other application like photoshop or IDimager are able to recognize the keyword phrases.

I have been looking for this on google, trying to understand if this is a limitation of php. Unfortunately, I did not find anything mentioning it.

Did you experience this?

Thanks, Yoel
Post Reply