PHP gets the EXIF information of the image via the Exif_read_data function
This article mainly introduces PHP through the Exif_read_data function to obtain the EXIF information of the image, by default, PHP read the image EXIF Information module is not open, we need to first open this module. Open EXIF module need mbstring support, here is not detailed, let's look at the use of the function
PHP gets the EXIF information of the picture, PHP comes with a exif_read_data function that can be used to read the EXIF information of the picture, the code from the PHP manual
?
1 2 3 4 5 6 7 8 9 10 11 12 13 |
echo "Test1.jpg: \ n "; $exif = Exif_read_data (' tests/test1.jpg ', ' IFD0 '); Echo $exif ===false? "No header data found. \ n ":" Image contains headers \ n "; $exif = Exif_read_data (' tests/test2.jpg ', 0, true); echo "Test2.jpg: \ n "; foreach ($exif as $key = = $section) { foreach ($section as $name = = $val) { echo "$key. $name: $val \ 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 21st 22 23 24 25 26 27 28 |
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 mentioned is the whole content of this article, I hope you can like.
http://www.bkjia.com/PHPjc/1003825.html www.bkjia.com true http://www.bkjia.com/PHPjc/1003825.html techarticle PHP through the Exif_read_data function to obtain the EXIF information of the picture This article mainly introduces PHP through the Exif_read_data function to obtain the EXIF information of the picture, by default, PHP read the picture EXIF information ...