首页 > 后端开发 > php教程 > php获取图片的exif信息

php获取图片的exif信息

WBOY
发布: 2016-07-25 08:45:14
原创
1044 人浏览过
php获取图片的exif信息,php自带一个exif_read_data函数可以用来读取图片的exif信息
  1. echo "test1.jpg:
    \n";
  2. $exif = exif_read_data('tests/test1.jpg', 'IFD0');
  3. echo $exif===false ? "No header data found.
    \n" : "Image contains headers
    \n";
  4. $exif = exif_read_data('tests/test2.jpg', 0, true);
  5. echo "test2.jpg:
    \n";
  6. foreach ($exif as $key => $section) {
  7. foreach ($section as $name => $val) {
  8. echo "$key.$name: $val
    \n";
  9. }
  10. }
  11. ?>
复制代码

输出结果如下
  1. test1.jpg:
  2. No header data found.
  3. test2.jpg:
  4. FILE.FileName: test2.jpg
  5. FILE.FileDateTime: 1017666176
  6. FILE.FileSize: 1240
  7. FILE.FileType: 2
  8. FILE.SectionsFound: ANY_TAG, IFD0, THUMBNAIL, COMMENT
  9. COMPUTED.html: width="1" height="1"
  10. COMPUTED.Height: 1
  11. COMPUTED.Width: 1
  12. COMPUTED.IsColor: 1
  13. COMPUTED.ByteOrderMotorola: 1
  14. COMPUTED.UserComment: Exif test image.
  15. COMPUTED.UserCommentEncoding: ASCII
  16. COMPUTED.Copyright: Photo (c) M.Boerger, Edited by M.Boerger.
  17. COMPUTED.Copyright.Photographer: Photo (c) M.Boerger
  18. COMPUTED.Copyright.Editor: Edited by M.Boerger.
  19. IFD0.Copyright: Photo (c) M.Boerger
  20. IFD0.UserComment: ASCII
  21. THUMBNAIL.JPEGInterchangeFormat: 134
  22. THUMBNAIL.JPEGInterchangeFormatLength: 523
  23. COMMENT.0: Comment #1.
  24. COMMENT.1: Comment #2.
  25. COMMENT.2: Comment #3end
  26. THUMBNAIL.JPEGInterchangeFormat: 134
  27. THUMBNAIL.Thumbnail.Height: 1
  28. THUMBNAIL.Thumbnail.Height: 1
复制代码


php, exif


来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板