phpDocumentor Exif
Classes
[ class tree: Exif ] [ index: Exif ] [ all elements ]

Class: ExifHelper

Source Location: /modules/exif/classes/ExifHelper.class

Class ExifHelper

Class Overview

A helper class for the EXIF module.

This class follows the Adapter pattern: 2 foreign packages with totally different APIs are made compatible with the G2 API. Methods starting with '_' (underscore), though not neccessarily declared private, must only be used internally in this class or subclasses.

Located in /modules/exif/classes/ExifHelper.class [line 84]



		
		
		
		

Methods

[ Top ]
Method Summary
GalleryStatus   addDefaultIptcProperties()   Add default IPTC properties for the given view mode to the end of current properties.
array   getExifData()   Return the wanted EXIF/IPTC data for one given file according to the given view mode.
array   getExifKeys()   Return the EXIF/IPTC keys that we know about (from lib/Exifer and lib/JPEG).
array   getExifValue()   Retrieve a single EXIF value by path from a nested associative array.
array   getIptcObject()   Return the raw IPTC data as a lib/JPEG object. This method call has the penalty to have to read in the lib/JPEG library (currently ~100KB) but nearly no penalties for the image: it isn't read here, that happens lazily when actually accessing IPTC values.
string   getIptcValue()   Retrieve a single IPTC value out of the given JPEG object by key path.
int   getOriginationTimestamp()   Return the timestamp when the picture was taken, as recorded in exif
array   getProperties()   Return the target properties for the given view mode
string   postProcessValue()   Sometimes the values that are returned aren't quite as we'd like to present them, so do a little post processing on the text
GalleryStatus   setDefaultProperties()   Reset the given view mode back to its default settings
GalleryStatus   setProperties()   Set the target properties for the given view mode
void   _fetchRawExifData()   Retrieve the raw EXIF data as returned by lib/Exifer.
void   _parseDate()   Parse date string into unix timestamp.

[ Top ]
Methods
addDefaultIptcProperties  [line 164]

  GalleryStatus addDefaultIptcProperties( int $viewMode  )

Add default IPTC properties for the given view mode to the end of current properties.

This is used on upgrade of the module from before IPTC times.

Parameters:
int   $viewMode: 

API Tags:
Return:  a status code


[ Top ]
getExifData  [line 261]

  array getExifData( string $path, int $viewMode  )

Return the wanted EXIF/IPTC data for one given file according to the given view mode.

This method doesn't return all available EXIF/IPTC data; instead it returns only the data existing and configured to be viewed in the given mode.

Parameters:
string   $path:  the path to the file
int   $viewMode: 

API Tags:
Return:  GalleryStatus a status code array title/value pairs


[ Top ]
getExifKeys  [line 551]

  array getExifKeys( )

Return the EXIF/IPTC keys that we know about (from lib/Exifer and lib/JPEG).

The resulting array is of the form:

'G2 exif/iptc property 0' => ( 'internationalized title 0', 'physical exif property' [, 'another physical exif property', ...]) 'G2 exif/iptc property 1' => ( 'internationalized title 1', 'physical exif property' [, 'another physical exif property', ...]) ...

The G2 exif/iptc properties are unique and have some correlation to the physical properties, but have been changed for our convenience, especially allowing to access several physical exif/iptc properties for one and the same logical G2 exif/iptc property. The first existing physical property in the given order will be used and returned.


API Tags:
Return:  exif keys


[ Top ]
getExifValue  [line 434]

  array getExifValue( &$source, array $keyPath, array $source  )

Retrieve a single EXIF value by path from a nested associative array.

The data source is an array like this:

foo => ( bar => (a => 1, b => 2, c => 3), baz => (d => 4, e => 5, f => 6))

and the key path is an array like this:

(foo, baz, d)

the resulting value would be "4"

Parameters:
array   $source:  the data source
array   $keyPath:  the key path
   &$source: 

API Tags:
Return:  GalleryStatus a status code string value


[ Top ]
getIptcObject  [line 229]

  array getIptcObject( string $path  )

Return the raw IPTC data as a lib/JPEG object. This method call has the penalty to have to read in the lib/JPEG library (currently ~100KB) but nearly no penalties for the image: it isn't read here, that happens lazily when actually accessing IPTC values.

Parameters:
string   $path:  the path to a jpeg file

API Tags:
Return:  GalleryStatus a status code object the JPEG object containing the IPTC data
See:  ExifHelper::getIptcValue()

Information Tags:
Todo:  (xlerb) reduce size of lib/JPEG: 1. remove whitespace/comments; 2. refactor according to lazy reading. Before refactoring, add timing tests.

[ Top ]
getIptcValue  [line 463]

  string getIptcValue( &$object, array $keyPath, [string $sourceEncoding = null], object $object  )

Retrieve a single IPTC value out of the given JPEG object by key path.

If the key path starts with 'IPTC', the second part is assumed to contain the physical IPTC name, more parts are silently ignored. When the path does not start with 'IPTC', this method returns null.

Parameters:
object   $object:  A JPEG object containing the IPTC values
array   $keyPath: 
string   $sourceEncoding:  encoding of the IPTC value, e.g. 'ISO-8859-1', defaults from current locale
   &$object: 

API Tags:
Return:  An IPTC value or null, if there is no such value or on error

Information Tags:
Todo:  (xlerb) have IPTC input charset default in EXIF/IPTC admin interface.
Todo:  (xlerb) have IPTC input charset overrides for albums (maybe images too?) for cases, where users from different countries can upload images with IPTC data. It is such a pain, that the charset used isn't recorded in IPTC headers.

[ Top ]
getOriginationTimestamp  [line 360]

  int getOriginationTimestamp( string $path  )

Return the timestamp when the picture was taken, as recorded in exif

Parameters:
string   $path:  the path to the file

API Tags:
Return:  an unix timestamp

Information Tags:
Todo:  (xlerb) check for IPTC.DateCreated and IPTC.TimeCreated additionally? Problem: only date set by Adobe in IPTC, set time to 0 = midnight or 12 = noon? Also, which priority has it: it was explicitely set by the editor, thus first priority? Or to be considered just before IFD0.DateTime == last modification time?

[ Top ]
getProperties  [line 485]

  array getProperties( int $viewMode  )

Return the target properties for the given view mode

Parameters:
int   $viewMode:  the view mode (EXIF_SUMMARY, etc)

API Tags:
Return:  GalleryStatus a status code array logical exif property names


[ Top ]
postProcessValue  [line 305]

  string postProcessValue( string $property, string $value  )

Sometimes the values that are returned aren't quite as we'd like to present them, so do a little post processing on the text

Parameters:
string   $property:  the property name (eg. "ApertureValue")
string   $value:  the value (eg. "f 2.8")

API Tags:
Return:  the result (eg. "f/2.8")


[ Top ]
setDefaultProperties  [line 92]

  GalleryStatus setDefaultProperties( int $viewMode  )

Reset the given view mode back to its default settings

Parameters:
int   $viewMode: 

API Tags:
Return:  a status code


[ Top ]
setProperties  [line 508]

  GalleryStatus setProperties( int $viewMode, array $properties  )

Set the target properties for the given view mode

Parameters:
int   $viewMode:  the view mode (EXIF_SUMMARY, etc)
array   $properties:  logical property key/value pairs

API Tags:
Return:  a status code


[ Top ]
_fetchRawExifData  [line 201]

  void _fetchRawExifData( string $path, &$rawExifData, array $rawExifData  )

Retrieve the raw EXIF data as returned by lib/Exifer.

Parameters:
string   $path:  the path to the file
array   $rawExifData:  reference to an array where to store the results as returned by read_exif_data_raw() from exifer
   &$rawExifData: 


[ Top ]
_parseDate  [line 387]

  void _parseDate( $value  )

Parse date string into unix timestamp.

Parameters:
   $value: 

API Tags:
Access:  private


[ Top ]

Documentation generated on Fri, 08 Oct 2010 04:51:12 -0700 by phpDocumentor 1.3.0RC6