The PHP JPEG Metadata Toolkit - Documentation

Go to Documentation - Home

EXIF and Kodak "Meta" Function Reference

Function: get_EXIF_JPEG
Description: Retrieves information from a Exchangeable Image File Format (EXIF) APP1 segment and returns it in an array. Uses information supplied by the get_jpeg_header_data function
Parameters: filename the filename of the JPEG image to process
Returns: OutputArray Array of EXIF records
FALSE If an error occured in decoding




Function: put_EXIF_JPEG
Description: Stores information into a Exchangeable Image File Format (EXIF) APP1 segment from an EXIF array.

WARNING: Because the EXIF standard allows pointers to data outside the APP1 segment, if there are any such pointers in a makernote, this function will DAMAGE them since it will not be aware that there is an external pointer. This will often happen with Makernotes that include an embedded thumbnail. This damage could be prevented where makernotes can be decoded, but currently this is not implemented.
Parameters: exif_data The array of EXIF data to insert into the JPEG header
jpeg_header_data The JPEG header into which the EXIF data should be stored, as from get_jpeg_header_data
Returns: jpeg_header_data JPEG header array with the EXIF segment inserted
FALSE If an error occured




Function: get_Meta_JPEG
Description:

Retrieves information from a Meta APP3 segment and returns it in an array. Uses information supplied by the get_jpeg_header_data function.

The Meta segment has the same format as an EXIF segment, but uses different tags

Parameters: filename the filename of the JPEG image to process
Returns: OutputArray Array of Meta records
FALSE If an error occured in decoding




Function: put_Meta_JPEG
Description: Stores information into a Meta APP3 segment from a Meta array.

WARNING: Because the Meta (EXIF) standard allows pointers to data outside the APP1 segment, if there are any such pointers in a makernote, this function will DAMAGE them since it will not be aware that there is an external pointer.
Parameters: meta_data The array of Meta data to insert into the JPEG header
jpeg_header_data The JPEG header into which the Meta data should be stored, as from get_jpeg_header_data
Returns: jpeg_header_data JPEG header array with the Meta segment inserted
FALSE If an error occured




Function: get_EXIF_TIFF
Description:

Retrieves information from a Exchangeable Image File Format (EXIF) within a TIFF file and returns it in an array.

Parameters: filename the filename of the TIFF image to process
Returns: OutputArray Array of EXIF records
FALSE If an error occured in decoding




Function: Interpret_EXIF_to_HTML
Description:

Generates html detailing the contents an APP1 EXIF array which was retrieved with a get_EXIF_JPEG function. Can also be used for APP3 Meta arrays.

Parameters: Exif_array the EXIF array,as read from get_EXIF_JPEG
filename the name of the Image file being processed (used by scripts which displays EXIF thumbnails)
Returns: output_str A string containing the HTML

Notes:

Unfortunately, because EXIF data may be distributed anywhere throughout an image file, rather than just being in one block, it is impossible to pass just a string containing only the EXIF information. Hence it is neccessary to be able to seek to any point in the file. This causes the HTTP and FTP wrappers not to work - i.e. the EXIF functions will only work with local files.

To work on an internet file, copy it locally to start with:

$newfilename = tempnam ( $dir, "tmpexif" );
copy ( "http://whatever.com", $newfilename );

There are three global variables which can be set to alter the look of any HTML output from Interpret_EXIF_to_HTML:

$GLOBALS['HIDE_UNKNOWN_TAGS'];
$GLOBALS['SHOW_BINARY_DATA_HEX'];
$GLOBALS['SHOW_BINARY_DATA_TEXT'];

These variables are all boolean and all default to FALSE