PHP Classes
elePHPant
Icontem

File: demo_ExifCapture.php

Recommend this page to a friend!
  Classes of Ray Paseur  >  Exif Capture  >  demo_ExifCapture.php  >  Download  
File: demo_ExifCapture.php
Role: Example script
Content type: text/plain
Description: Demonstration
Class: Exif Capture
Extract metadata from picture files in Exif format
Author: By
Last change:
Date: 5 months ago
Size: 1,771 bytes
 

Contents

Class file image Download
<?php // demo_ExifCapture.php
/**
 * Examples using the ExifCapture class.
 */
error_reporting(E_ALL);

require_once(
'class_ExifCapture.php');
$exif_obj = new ExifCapture;
echo
'<pre>'; // MAKE THE OUTPUT EASY TO READ


// WORK WITH A SINGLE FILE
$uri = 'images/IMG_2031.JPG';


// MINIMAL DATA RETURN
$exif_data = $exif_obj->get_required_data($uri);
echo
PHP_EOL;
echo
"<b>$uri</b>" . PHP_EOL;
print_r($exif_data);
echo
PHP_EOL;


// ADD A FEW ELEMENTS TO OUR REQUIRED COLLECTION
$exif_obj->set_required_item('Height');
$exif_obj->set_required_item('Width');
$exif_obj->set_required_item('Software');


// SLIGHTLY LARGER DATA RETURN
$exif_data = $exif_obj->get_required_data($uri);
echo
PHP_EOL;
echo
"<b>$uri</b>" . PHP_EOL;
print_r($exif_data);
echo
PHP_EOL;


// CREATE AN IMAGE LIST FOR THE ENTIRE DIRECTORY
$exif_obj->get_image_list('images');

// SHOW INCLUDED AND EXCLUDED FILES
echo PHP_EOL . "<b>Here are the files we INcluded</b>" . PHP_EOL;
print_r($exif_obj->included_files);
echo
PHP_EOL;

echo
PHP_EOL . "<b>Here are the files we EXcluded</b>" . PHP_EOL;
print_r($exif_obj->excluded_files);
echo
PHP_EOL;


// PROCESS THE IMAGE LIST, SHOWING ONLY THE REQUIRED DATA
foreach ($exif_obj->included_files as $uri)
{
   
$exif_data = $exif_obj->get_required_data($uri);
    echo
PHP_EOL;
    echo
"<b>$uri</b>" . PHP_EOL;
   
print_r($exif_data);
    echo
PHP_EOL;
}

// PROCESS THE DIRECTORY, SHOWING ALL THE INFORMATION WE GOT
foreach ($exif_obj->included_files as $uri)
{
   
$exif_data = $exif_obj->get_image_data($uri);
    echo
PHP_EOL;
    echo
"<b>$uri</b>" . PHP_EOL;
   
print_r($exif_data);
    echo
PHP_EOL;
}

// GATHER EVERYTHING PHP KNOWS ABOUT EXIF AND SHOW THE OBJECT PROPERTIES (LARGE OUTPUT)
$exif_obj->build_exif_array();
print_r($exif_obj);