Search code examples
phpimageexif

Finding keywords in image data


I kinda ran into a problem, I'm working on a small image site for a photographer, the photographer uses photoshop to store information into the image.
Information such as image data, location, descriptions, ...

He's been doing this since CS3.

When user uploads a picture to the site, he wants everything to go automatically, so I was trying to read out all the keywords, like this:

$size = getimagesize($path, $info);
if(isset($info['APP13'])) {
    $iptc = iptcparse($info['APP13']);

    if(isset($iptc['2#025'])) {
        $tagsArr = $iptc['2#025'];
    } else {
         $tagsArr = array();
    }
}

This all works fine for images saved in CS5, but for images saved in CS3 it fails, even though I'm 100% sure the keywords are in there.

To give an example:
This one fails - http://woutr.be/naturalight/uploads/ea568fea3e7eb1448d30fb823f477aac.jpg
This one works - http://woutr.be/naturalight/uploads/e3f2e6db833803a77eb75aae16e8c8ec.jpg

I've been looking into this for a few days, but I can't figure out why this doesn't work for some images.


Solution

  • I know you had mentioned that you tried ozhiker's code before, but I was able to pull a full list of keywords from both images using Photoshop_File_Info.php

    http://www.ozhiker.com/electronics/pjmt/download.html

    From file 1:

    amphibian aquatic belgium close-up common frog europe frog froglet leaf metamorphosis pond reproduction silhouette spring veins water waterplantsamfibie belgie blad bruine kikker europa kikker kikkervisje metamorfose nerven poel silhouet vijver voorjaar voortplanting watermilieu waterplanten

    From file 2:

    finland abstract boom tree bomen trees boomstam dromerig effect soft zacht kleur colour lijnen lines patroon pattern patronen patterns scenic picturesque sfeer atmosphere bos forest naaldhout conifer pine forest blauw blue lijnen lines sparrenbos fijnsparrenbos firtree spar fijnspar picea abies norway spruce habitat national park alps europe nationaal park nature natuur woud vegetatie plant vegetation planting tree boom boslandschap wildernis monochrome movement beweging