php通过exif_read_data函数获取图片的exif信息
作者:hebedich 时间:2023-10-27 09:01:44
php获取图片的exif信息,php自带一个exif_read_data函数可以用来读取图片的exif信息,代码来自php手册
<?php
echo "test1.jpg:<br />\n";
$exif = exif_read_data('tests/test1.jpg', 'IFD0');
echo $exif===false ? "No header data found.<br />\n" : "Image contains headers<br />\n";
$exif = exif_read_data('tests/test2.jpg', 0, true);
echo "test2.jpg:<br />\n";
foreach ($exif as $key => $section) {
foreach ($section as $name => $val) {
echo "$key.$name: $val<br />\n";
}
}
?>
输出结果如下
test1.jpg:
No header data found.
test2.jpg:
FILE.FileName: test2.jpg
FILE.FileDateTime: 1017666176
FILE.FileSize: 1240
FILE.FileType: 2
FILE.SectionsFound: ANY_TAG, IFD0, THUMBNAIL, COMMENT
COMPUTED.html: width="1" height="1"
COMPUTED.Height: 1
COMPUTED.Width: 1
COMPUTED.IsColor: 1
COMPUTED.ByteOrderMotorola: 1
COMPUTED.UserComment: Exif test image.
COMPUTED.UserCommentEncoding: ASCII
COMPUTED.Copyright: Photo (c) M.Boerger, Edited by M.Boerger.
COMPUTED.Copyright.Photographer: Photo (c) M.Boerger
COMPUTED.Copyright.Editor: Edited by M.Boerger.
IFD0.Copyright: Photo (c) M.Boerger
IFD0.UserComment: ASCII
THUMBNAIL.JPEGInterchangeFormat: 134
THUMBNAIL.JPEGInterchangeFormatLength: 523
COMMENT.0: Comment #1.
COMMENT.1: Comment #2.
COMMENT.2: Comment #3end
THUMBNAIL.JPEGInterchangeFormat: 134
THUMBNAIL.Thumbnail.Height: 1
THUMBNAIL.Thumbnail.Height: 1
以上所述就是本文的全部内容了,希望大家能够喜欢。
标签:php,图片exif信息
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Vue中qs插件的使用详解
2023-07-02 17:07:06
![](https://img.aspxhome.com/file/2023/4/139934_0s.png)
定位后无法选择容器的内容解决方案
2008-07-30 12:08:00
详解PANDAS 数据合并与重塑(join/merge篇)
2022-12-13 04:02:08
![](https://img.aspxhome.com/file/2023/0/101020_0s.png)
关于计算到期时间的问题
2009-05-26 15:51:00
Javascript的匿名函数
2008-05-07 13:33:00
区分有单选框的选项和普通的选项
2008-04-17 13:44:00
![](/images/sg_trans.gif)
python多线程编程方式分析示例详解
2023-05-13 04:56:01
在.NetCore(C#)中使用ODP.NET Core+Dapper操作Oracle数据库
2024-01-26 05:33:06
基于Python创建可定制的HTTP服务器
2023-08-09 22:46:09
![](https://img.aspxhome.com/file/2023/0/93540_0s.png)
Sql Server中存储过程中输入和输出参数(简单实例 一看就懂)
2012-11-30 20:09:36
MySQL数据库完全卸载的方法
2024-01-28 05:59:21
![](https://img.aspxhome.com/file/2023/7/120837_0s.png)
python Pandas 读取txt表格的实例
2023-12-05 01:23:48
MS sqlserver 2008数据库转换成2000版本的方法
2024-01-28 11:37:53
![](https://img.aspxhome.com/file/2023/6/104086_0s.jpg)
利用Python实现数值积分的方法
2023-07-11 10:16:31
![](https://img.aspxhome.com/file/2023/1/66341_0s.png)
用户反馈对产品设计的帮助
2009-02-09 13:15:00
![](https://img.aspxhome.com/file/UploadPic/20092/9/blog02081-75s.jpg)
深入了解vue-router原理并实现一个小demo
2024-04-30 10:25:31
![](https://img.aspxhome.com/file/2023/5/130215_0s.jpg)
聊聊通过celery_one避免Celery定时任务重复执行的问题
2021-05-20 13:19:12
跟老齐学Python之有容乃大的list(4)
2023-03-13 21:53:17
OpenCV 轮廓检测的实现方法
2023-06-16 01:40:48
![](https://img.aspxhome.com/file/2023/6/121736_0s.png)
conn.execute的用法
2008-07-03 12:58:00