PHP Classes
elePHPant
Icontem

File: readme_ExifCapture.txt

Recommend this page to a friend!
  Classes of Ray Paseur  >  Exif Capture  >  readme_ExifCapture.txt  >  Download  
File: readme_ExifCapture.txt
Role: Documentation
Content type: text/plain
Description: Readme
Class: Exif Capture
Extract metadata from picture files in Exif format
Author: By
Last change:
Date: 7 months ago
Size: 2,549 bytes
 

 

Contents

Class file image Download
Class ExifCapture

This class uses the PHP Exif extension to extract metadata from image
files.  Although PHP can recognize many kinds of image files, the Exif
extension only seems to work well with JPG and TIF files.

The Class was motivated by this need:
https://www.phpclasses.org/recommend/1119-I-need-the-exif-data-from-a-lot-off-pictures.html

References:
https://sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html
http://exif.org/Exif2-2.PDF
http://php.net/manual/en/ref.exif.php
http://php.net/manual/en/exif.requirements.php
 
Exif has a lot of "loose ends" shown here
https://stackoverflow.com/questions/5184748/php-bad-exif-data-warnings-what-to-do
https://bugs.php.net/bug.php?id=72819

Exif data comes in multidimensional arrays.  Which arrays are present
in any given image?  Who knows!  Consult the "SectionsFound" element.
In my experimentation the most useful information was contained in
FILE, COMPUTED, IFD0, and EXIF arrays.  Within these arrays the items
are given easy-to-understand names like "FileName" and "MimeType."

BTW, It's IFD zero, not IFD oh.

The Class provides the following methods

__construct() makes opinionated assumptions about what information
will be captured, and what unuseful information will be discarded.
You may want to modify these underlying assumptions.

set_included_array() can be used to capture other sections of the Exif.

set_required_item() can be used to limit the return to certain items.

set_excluded_item() can be used to remove items from the collection.

get_image_data() returns as much data as possible for a given image
file, subject to the constraints of the included arrays and the 
excluded items.  This can be quite a lot of information.

get_required_data() returns only the information that has been 
explicitly requested by the constructor and set_required_item().

get_image_list() creates class properties that segregate files with
Exif information from files that do not provide PHP-readable Exif.
The properties are arrays that can be iterated with foreach().

build_exif_array() finds all of the Exif values that PHP knows about.
Many (perhaps most) of these are not going to be present in your
image file. Call this method, then print the object to see them.

Some image files will have more Exif than others. After processing 
with Photoshop, some image files gain additional Exif.  Some image
editors can strip Exif, which may make the image file smaller so 
that it loads faster over the internet.

Please see the demo file for examples that use the methods.