how to extract camera related information from ima

2019-06-04 05:35发布

问题:

How can I extract camera related information (eg. camera model, date taken etc) from an image stored in the database? For example, I resized an image and uploaded it and saved its path in database. I want to display basic camera information while displaying the image, therefore I want to extract the information. Thanks.

回答1:

You want to read the EXIF data. For PHP, use exif_read_data. Sample:

<?php
$exif = exif_read_data('img.jpg');
$model = $exif['Model'];
$iso = $exif['ISOSpeedRatings'];
$taken = $exif['DateTime'];


回答2:

What is the image type? What language are you using?

Assuming, for example, you're talking about JPG images then what you're probably trying to do is read the EXIF data from the file. If you're using, for example, Java then there are various libraries such as this one to help you.

Google will uncover many, many more depending on your language/environment.



回答3:

What you want to obtain is the EXIF data.

Take a look here for some suggestions about libraries/etc...

http://en.wikipedia.org/wiki/Exchangeable_image_file_format#Program_support

PHP has an EXIF library: http://php.net/manual/en/book.exif.php