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.