如何使用 PHP 从图像文件中读取 Lightroom 关键字?
我有一个照片社区 (www.jungledragon.com),允许用户上传照片。我的平台是 PHP/CodeIgniter。
作为上传过程的一部分,我已经使用 PHP 的 exif_read_data 函数读取 EXIF 信息,效果很好。我阅读相机详细信息并将其显示在信息选项卡上。
最重要的是,用户上传照片后需要在网站上手动设置照片标题、描述和标签。但是,某些用户在其图像管理程序(例如 Lightroom)中管理这些字段。如果我也能读到这些就太好了,上传将成为一种完全的乐趣。
我已经改进了 EXIF 读取来读取“标题”,这样用户上传后就不必再设置图像标题了。现在我正在寻找阅读关键字,这就是我陷入困境的地方。以下是 Lightroom 中图像的部分屏幕截图:
我可以读取元数据,但如何读取关键词?它不在元数据内部的事实让我想知道它是否可能?我尝试使用 exif_read_data 读取可以获得的每个值(ANY_TAG、IFD0、EXIF、APP12),但找不到关键字。
有什么想法吗?
I have a photo community (www.jungledragon.com) that allows users to upload photos. My platform is PHP/CodeIgniter.
As part of the upload process I'm already reading EXIF info using PHP's exif_read_data function, which works fine. I read camera details and show these on an info tab.
On top of that, user's are expected to manually set the photo title, description and tags on the website after uploading the photo. However, some users manage these fields in their image management program, for example Lightroom. It would be great if I could read those as well, uploading would become a total joy.
I already improved my EXIF reading to read the "caption", this way users don't have to set the image title after uploading anymore. Now I'm looking to read keywords, which is where I am stuck. Here's a partial screenshot of an image in Lightroom:
I can read the Metadata, but how do I read the keywords? The fact that it is not inside metadata makes me wonder if it's at all possible? I've tried reading every value I can get (ANY_TAG, IFD0, EXIF, APP12) using exif_read_data, but the keywords are not to be found.
Any thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
正如所建议的,您可能必须使用另一种读取元数据的方法。
http://www.foto-biz.com/Lightroom/Exif -vs-iptc-vs-xmp
图像关键字可能存储在 IPTC 中而不是 EXIF 中。我不知道是否有读取 iptc 的标准平台方法,但快速谷歌显示此
http://php.net/manual/en/function.iptcparse.php
As suggested you may have to use another method of reading metadata.
http://www.foto-biz.com/Lightroom/Exif-vs-iptc-vs-xmp
Image keywords may be stored in IPTC and not in EXIF. I don't know if there is a standard platform method for reading iptc but a quick google shows this
http://php.net/manual/en/function.iptcparse.php
经过长时间的研究,我找到了获取 lightroom 在 jpg 文件中导出关键字的解决方案:
After a long research, i found the solution to get keywords exported by lightroom in a jpg file :
尝试使用 PEL,这是一个比 exif_read_data() 对于 exif 数据更全面的库。
Try using PEL, a much more comprehensive library than exif_read_data() for exif data.