source: extensions/edit_gmaps/admin/include/Makernotes/agfa.php @ 9412

Last change on this file since 9412 was 9412, checked in by cljosse, 13 years ago
File size: 4.3 KB
Line 
1<?php
2
3/******************************************************************************
4*
5* Filename:     agfa.php
6*
7* Description:  Agfa Makernote Parser
8*               Provides functions to decode an Agfa EXIF makernote and to interpret
9*               the resulting array into html.
10*
11*               Agfa Makernote Format:
12*
13*               Field           Size            Description
14*               ----------------------------------------------------------------
15*               Header          8 Bytes         "AGFA \x00\x01"
16*               IFD Data        Variable        Standard IFD Data using Olympus Tags
17*               ----------------------------------------------------------------
18*
19*
20* Author:      Evan Hunter
21*
22* Date:         30/7/2004
23*
24* Project:      JPEG Metadata
25*
26* Revision:     1.00
27*
28* URL:          http://electronics.ozhiker.com
29*
30* Copyright:    Copyright " . $auteur . " 2004
31*               This file may be used freely for non-commercial purposes.For
32*               commercial uses please contact the author: evan@ozhiker.com
33*
34******************************************************************************/
35
36
37// Agfa makernote uses Olympus tags - ensure they are included
38
39include_once 'olympus.php';
40
41
42
43// Add the Parser function to the list of Makernote Parsers. (Interpreter Functions are supplied by the Olympus script)
44
45$GLOBALS['Makernote_Function_Array']['Read_Makernote_Tag'][] = "get_Agfa_Makernote";
46
47
48
49
50
51/******************************************************************************
52*
53* Function:     get_Agfa_Makernote
54*
55* Description:  Decodes the Makernote tag and returns the new tag with the decoded
56*               information attached. Returns false if this is not a makernote
57*               that can be processed with this script
58*
59* Parameters:   Makernote_Tag - the element of an EXIF array containing the
60*                               makernote, as returned from get_EXIF_JPEG
61*               EXIF_Array - the entire EXIF array containing the
62*                            makernote, as returned from get_EXIF_JPEG, in
63*                            case more information is required for decoding
64*               filehnd - an open file handle for the file containing the
65*                         makernote - does not have to be positioned at the
66*                         start of the makernote
67*               Make_Field - The contents of the EXIF Make field, to aid
68*                            determining whether this script can decode
69*                            the makernote
70*
71*
72* Returns:      Makernote_Tag - the Makernote_Tag from the parameters, but
73*                               modified to contain the decoded information
74*               FALSE - If this script could not decode the makernote, or if
75*                       an error occured in decoding
76*
77******************************************************************************/
78
79function get_Agfa_Makernote( $Makernote_Tag, $EXIF_Array, $filehnd, $Make_Field )
80{
81        // Check if the Make Field contains the word Agfa
82        if ( stristr( $Make_Field, "Agfa" ) === FALSE )
83        {
84                // The Make Field doesnt contain the word Agfa
85                return FALSE;
86        }
87
88        // Check if the header exists at the start of the Makernote
89        if ( substr( $Makernote_Tag['Data'], 0, 7 ) != "AGFA \x00\x01" )
90        {
91                // This isn't a Agfa Makernote, abort
92                return FALSE ;
93        }
94
95        // Seek to the start of the IFD
96        fseek($filehnd, $Makernote_Tag['Tiff Offset'] + $Makernote_Tag['Offset'] + 8 );
97
98        // Read the IFD(s) into an array
99        $Makernote_Tag['Decoded Data'] = read_Multiple_IFDs( $filehnd, $Makernote_Tag['Tiff Offset'], $Makernote_Tag['ByteAlign'], "Olympus" );
100
101        // Save some information into the Tag element to aid interpretation
102        $Makernote_Tag['Decoded'] = TRUE;
103        $Makernote_Tag['Makernote Type'] = "Agfa";
104        $Makernote_Tag['Makernote Tags'] = "Olympus";
105
106        // Return the new tag
107        return $Makernote_Tag;
108
109}
110
111/******************************************************************************
112* End of Function:     get_Agfa_Makernote
113******************************************************************************/
114
115
116
117?>
Note: See TracBrowser for help on using the repository browser.