如何在WordPress中获取帖子图片的EXIF数据
我知道从上传的图像中提取的 EXIF 数据存储在 WordPress 数据库中,但我没有找到找到它们或将它们放入帖子中的正确方法。我在网上四处寻找,但找到的所有解决方案都不起作用。
您知道从帖子中获取图片 EXIF 数据的有效方法吗?我不介意是 php 还是 jQuery 解决方案,只要它能完成工作即可。
感谢您抽出时间。
后来编辑:实际上我找到了问题的原因。我设法调用 wp_get_attachment_metadata 但除了图像的宽度和高度之外,我收到的相机、光圈、ISO、焦距、快门速度等为零。调用类似于 $imgmeta['image_meta']['camera']
是我缺少什么吗?
后来编辑:发现问题。服务器扩展 php_exif 未启用。谢谢你的时间
I understand that the EXIF data extracted from uploaded images are stored in the WordPress database, but i am not finding the proper way to find them or get them in a post for instance. I was looking around on web but all solutions found didn't work.
Do you know an efficient way to get the EXIF data of a picture from post? I don't mind if is a php or jQuery solution as long it does the job.
Thanks for your time.
LATER EDIT: actually i found the reason for my problem. I managed to call the wp_get_attachment_metadata but except the width and height of image, i receive zero for camera, aperture, ISO, focal lenght, shutter speed etc. The call is something like $imgmeta['image_meta']['camera']
is there something i am missing?
LATER LATER EDIT: Found the issue. server extension php_exif wasn't enabled. thanks for your time
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 EXIF 读取 php.net 数据。按照第一个示例,您应该能够提取您想要的任何内容...
编辑:或者您可以使用 jQuery EXIF
编辑 2:对于 jQuery,您必须使用与 同源策略 相同的域,因为它适用于 EXIF 阅读器使用 HTTP 请求
you can use EXIF Read Data from php.net. Folow first example and you should be able to extract whatever you want ...
EDIT: or you can use jQuery EXIF
EDIT 2: for jQuery you must use same domain as the Same Origin Policy applies to EXIF reader as it uses HTTP Requests
你可以安装wordpress插件“HK EXIF标签”,它只会添加一个每张图片下面都有一行带有 EXIF 信息的行。
You could install the wordpress plugin "HK EXIF tags", which just adds one line below each image with the EXIF information.