PHP Classes

Exif Capture: Extract metadata from picture files in Exif format

Recommend this page to a friend!
  Info   View files Example   Screenshots Screenshots   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 121 All time: 9,365 This week: 163Up
Version License PHP version Categories
exifcapture 1.0.0Public Domain5PHP 5, Graphics, Files and Folders
Description Author

This package can Extract metadata from picture files in Exif format.

It can take the path of image file and parse it to extract details of the image like the width, height, software that was used to generate the image.

The class can extract the required details of the specified image and returns it as an associative array.


extract exif data from pictures
I need the exif data from a lot off pictures

Picture of Ray Paseur
  Performance   Level  
Name: Ray Paseur is available for providing paid consulting. Contact Ray Paseur .
Classes: 8 packages by
Country: United States United States
Age: 72
All time rank: 2269312 in United States United States
Week rank: 515 Up55 in United States United States Up
Innovation award
Innovation award
Nominee: 5x

Winner: 1x

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:

Exif has a lot of "loose ends" shown here

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.
  • screenshot.png
  Files folder image Files  
File Role Description
Plain text file class_ExifCapture.php Class Class Source
Accessible without login Plain text file demo_ExifCapture.php Example Demonstration
Accessible without login Plain text file readme_ExifCapture.txt Doc. Readme

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:9,365
This week:163Up
For more information send a message to info at phpclasses dot org.