PHP through EXIF

Source: Internet
Author: User
Tags foreach

This article mainly introduced the PHP through the Exif_read_data function to obtain the image EXIF information, by default, the PHP reads the picture EXIF information module is not open, we need to open this module first. To open the EXIF module requires mbstring support, here is not detailed, we first look at the use of the function

PHP to get the image of EXIF information, PHP with a exif_read_data function can be used to read the image of EXIF information, code from the PHP manual

?

1 2 3 4 5 6 7 8 9 10 11 12-13 <?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 ";} }?>

The output is as follows

?

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 The 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

The above is the entire contents of this article, I hope you can enjoy.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.