PHP _php Tutorial for obtaining EXIF information for images via Exif_read_data function

Source: Internet
Author: User

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 ...

  • 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.