1 | <?php |
---|
2 | |
---|
3 | /****************************************************************************** |
---|
4 | * |
---|
5 | * Filename: epson.php |
---|
6 | * |
---|
7 | * Description: Epson Makernote Parser |
---|
8 | * Provides functions to decode an Epson EXIF makernote and to interpret |
---|
9 | * the resulting array into html. |
---|
10 | * |
---|
11 | * Epson Makernote Format: |
---|
12 | * |
---|
13 | * Field Size Description |
---|
14 | * ---------------------------------------------------------------- |
---|
15 | * Header 8 Bytes "EPSON\x00\x01\x00" |
---|
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 | // Epson makernote uses Olympus tags - ensure they are included |
---|
38 | |
---|
39 | include_once 'olympus.php'; |
---|
40 | |
---|
41 | |
---|
42 | |
---|
43 | |
---|
44 | // Add the Parser function to the list of Makernote Parsers. (Interpreter Functions are supplied by the Olympus script) |
---|
45 | |
---|
46 | $GLOBALS['Makernote_Function_Array']['Read_Makernote_Tag'][] = "get_Epson_Makernote"; |
---|
47 | |
---|
48 | |
---|
49 | |
---|
50 | |
---|
51 | |
---|
52 | /****************************************************************************** |
---|
53 | * |
---|
54 | * Function: get_Epson_Makernote |
---|
55 | * |
---|
56 | * Description: Decodes the Makernote tag and returns the new tag with the decoded |
---|
57 | * information attached. Returns false if this is not a makernote |
---|
58 | * that can be processed with this script |
---|
59 | * |
---|
60 | * Parameters: Makernote_Tag - the element of an EXIF array containing the |
---|
61 | * makernote, as returned from get_EXIF_JPEG |
---|
62 | * EXIF_Array - the entire EXIF array containing the |
---|
63 | * makernote, as returned from get_EXIF_JPEG, in |
---|
64 | * case more information is required for decoding |
---|
65 | * filehnd - an open file handle for the file containing the |
---|
66 | * makernote - does not have to be positioned at the |
---|
67 | * start of the makernote |
---|
68 | * Make_Field - The contents of the EXIF Make field, to aid |
---|
69 | * determining whether this script can decode |
---|
70 | * the makernote |
---|
71 | * |
---|
72 | * |
---|
73 | * Returns: Makernote_Tag - the Makernote_Tag from the parameters, but |
---|
74 | * modified to contain the decoded information |
---|
75 | * FALSE - If this script could not decode the makernote, or if |
---|
76 | * an error occured in decoding |
---|
77 | * |
---|
78 | ******************************************************************************/ |
---|
79 | |
---|
80 | function get_Epson_Makernote( $Makernote_Tag, $EXIF_Array, $filehnd, $Make_Field ) |
---|
81 | { |
---|
82 | |
---|
83 | // Check if the Make Field contains the word Epson |
---|
84 | if ( stristr( $Make_Field, "Epson" ) === FALSE ) |
---|
85 | { |
---|
86 | return FALSE; |
---|
87 | } |
---|
88 | |
---|
89 | // Check if the header exists at the start of the Makernote |
---|
90 | if ( substr( $Makernote_Tag['Data'], 0, 8 ) != "EPSON\x00\x01\x00" ) |
---|
91 | { |
---|
92 | // This isn't a Epson Makernote, abort |
---|
93 | return FALSE ; |
---|
94 | } |
---|
95 | |
---|
96 | |
---|
97 | // Seek to the start of the IFD |
---|
98 | fseek($filehnd, $Makernote_Tag['Tiff Offset'] + $Makernote_Tag['Offset'] + 8 ); |
---|
99 | |
---|
100 | // Read the IFD(s) into an array |
---|
101 | $Makernote_Tag['Decoded Data'] = read_Multiple_IFDs( $filehnd, $Makernote_Tag['Tiff Offset'], $Makernote_Tag['ByteAlign'], "Olympus" ); |
---|
102 | |
---|
103 | // Save some information into the Tag element to aid interpretation |
---|
104 | $Makernote_Tag['Decoded'] = TRUE; |
---|
105 | $Makernote_Tag['Makernote Type'] = "Epson"; |
---|
106 | $Makernote_Tag['Makernote Tags'] = "Olympus"; |
---|
107 | |
---|
108 | |
---|
109 | // Return the new tag |
---|
110 | return $Makernote_Tag; |
---|
111 | |
---|
112 | } |
---|
113 | |
---|
114 | /****************************************************************************** |
---|
115 | * End of Function: get_Epson_Makernote |
---|
116 | ******************************************************************************/ |
---|
117 | |
---|
118 | |
---|
119 | ?> |
---|