php gets the exif information of the image

WBOY
Release: 2016-07-25 08:45:14
Original
989 people have browsed it
PHP gets the exif information of the image. PHP comes with an exif_read_data function that can be used to read the exif information of the image
  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. ?>
Copy code

The output result is as follows
  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
Copy code


php,exif


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!