在图像数据中查找关键字


Finding keywords in image data

我遇到了一个问题,我正在为一位摄影师开发一个小型图像网站,摄影师使用photoshop将信息存储到图像中
图像数据、位置、描述等信息。。。

他从CS3开始就这么做了。

当用户上传图片到网站时,他希望一切都能自动进行,所以我试着读出所有的关键词,比如:

$size = getimagesize($path, $info);
if(isset($info['APP13'])) {
    $iptc = iptcparse($info['APP13']);
    if(isset($iptc['2#025'])) {
        $tagsArr = $iptc['2#025'];
    } else {
         $tagsArr = array();
    }
}

这一切对保存在CS5中的图像都很好,但对于保存在CS3中的图像,它失败了,尽管我100%确定关键字在那里。

举个例子:
这个失败了——http://woutr.be/naturalight/uploads/ea568fea3e7eb1448d30fb823f477aac.jpg
这个有效-http://woutr.be/naturalight/uploads/e3f2e6db833803a77eb75aae16e8c8ec.jpg

我已经研究了几天了,但我不明白为什么这对一些图像不起作用。

我知道你之前提到过你尝试过ozhiker的代码,但我能够使用Photoshop_File_Info.php 从两张图像中提取完整的关键字列表

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

来自文件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

来自文件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

我刚刚检查了您的两个文件,失败的文件没有工作文件所具有的关键字。失败的文件描述了一个没有关键字的"Rana Temporaria",而工作的文件描述的是一个有一长串关键字的"松林",如"阿尔卑斯山、植被、自然"。它们都有一个JPEG APP13数据段,但这些数据段的内容截然不同。

您尝试过exif_函数吗。他们可以读取图像的标题。

http://php.net/manual/en/book.exif.php