1 | <?php |
---|
2 | /* |
---|
3 | * --:: JPEG MetaDatas ::------------------------------------------------------- |
---|
4 | * |
---|
5 | * Author : Grum |
---|
6 | * email : grum at piwigo.org |
---|
7 | * website : http://photos.grum.fr |
---|
8 | * |
---|
9 | * << May the Little SpaceFrog be with you ! >> |
---|
10 | * |
---|
11 | * |
---|
12 | * +-----------------------------------------------------------------------+ |
---|
13 | * | JpegMetaData - a PHP based Jpeg Metadata manager | |
---|
14 | * +-----------------------------------------------------------------------+ |
---|
15 | * | Copyright(C) 2010 Grum - http://www.grum.fr | |
---|
16 | * +-----------------------------------------------------------------------+ |
---|
17 | * | This program is free software; you can redistribute it and/or modify | |
---|
18 | * | it under the terms of the GNU General Public License as published by | |
---|
19 | * | the Free Software Foundation | |
---|
20 | * | | |
---|
21 | * | This program is distributed in the hope that it will be useful, but | |
---|
22 | * | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
23 | * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
24 | * | General Public License for more details. | |
---|
25 | * | | |
---|
26 | * | You should have received a copy of the GNU General Public License | |
---|
27 | * | along with this program; if not, write to the Free Software | |
---|
28 | * | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
29 | * | USA. | |
---|
30 | * +-----------------------------------------------------------------------+ |
---|
31 | * |
---|
32 | * |
---|
33 | * ----------------------------------------------------------------------------- |
---|
34 | * |
---|
35 | * The CanonReader class is the dedicated to read the specific Canon tags |
---|
36 | * |
---|
37 | * ====> See MakerNotesReader.class.php to know more about the structure <====== |
---|
38 | * |
---|
39 | * ----------------------------------------------------------------------------- |
---|
40 | * |
---|
41 | * .. Notes .. |
---|
42 | * |
---|
43 | * |
---|
44 | * The CanonReader class is derived from the MakerNotesReader class. |
---|
45 | * |
---|
46 | * =====> See MakerNotesReader.class.php to know more about common methods <==== |
---|
47 | * |
---|
48 | * ----------------------------------------------------------------------------- |
---|
49 | */ |
---|
50 | |
---|
51 | |
---|
52 | |
---|
53 | require_once(JPEG_METADATA_DIR."TagDefinitions/CanonTags.class.php"); |
---|
54 | require_once(JPEG_METADATA_DIR."Readers/MakerNotesReader.class.php"); |
---|
55 | |
---|
56 | class CanonReader extends MakerNotesReader |
---|
57 | { |
---|
58 | /** |
---|
59 | * The constructor needs, like the ancestor, the datas to be parsed |
---|
60 | * |
---|
61 | * Some datas are offset on extra data, and this offset can be (some time) |
---|
62 | * absolute inside the IFD, or relative. So, the offset of the IFD structure |
---|
63 | * is needed |
---|
64 | * |
---|
65 | * The byte order can be different from the TIFF byte order ! |
---|
66 | * |
---|
67 | * The constructor need the maker signature (see the MakerNotesSignatures |
---|
68 | * class for a list of known signatures) |
---|
69 | * |
---|
70 | * @param String $data |
---|
71 | * @param ULong $offset : offset of IFD block in the jpeg file |
---|
72 | * @param String $byteOrder |
---|
73 | * @param String $makerSignature : |
---|
74 | */ |
---|
75 | function __construct($data, $offset, $byteOrder, $makerSignature) |
---|
76 | { |
---|
77 | /* |
---|
78 | * Canon don't have signatures in his maker note, starting directly with |
---|
79 | * the number of entries |
---|
80 | */ |
---|
81 | $this->maker = MAKER_CANON; |
---|
82 | $this->header = ""; |
---|
83 | $this->headerSize = 0; |
---|
84 | |
---|
85 | parent::__construct($data, $offset, $byteOrder); |
---|
86 | } |
---|
87 | |
---|
88 | |
---|
89 | /** |
---|
90 | * initialize the definition for Pentax exif tags |
---|
91 | */ |
---|
92 | protected function initializeTagDef() |
---|
93 | { |
---|
94 | $this->tagDef = new CanonTags(); |
---|
95 | } |
---|
96 | |
---|
97 | /** |
---|
98 | * skip the IFD header |
---|
99 | */ |
---|
100 | protected function skipHeader($headerSize=0) |
---|
101 | { |
---|
102 | parent::skipHeader($headerSize); |
---|
103 | } |
---|
104 | |
---|
105 | /** |
---|
106 | * this function do the interpretation of specials tags |
---|
107 | * |
---|
108 | * the function return the interpreted value for the tag |
---|
109 | * |
---|
110 | * @param $tagId : the id of the tag |
---|
111 | * @param $values : 'raw' value to be interpreted |
---|
112 | * @param UByte $type : if needed (for IFD structure) the type of data |
---|
113 | * @param ULong $valueOffset : if needed, the offset of data in the jpeg file |
---|
114 | * @return String or Array or DateTime or Integer or Float... |
---|
115 | */ |
---|
116 | protected function processSpecialTag($tagId, $values, $type, $valuesOffset=0) |
---|
117 | { |
---|
118 | switch($tagId) |
---|
119 | { |
---|
120 | default: |
---|
121 | $returned="Not yet implemented;".ConvertData::toHexDump($tagId, ByteType::USHORT)." => ".ConvertData::toHexDump($values, $type); |
---|
122 | break; |
---|
123 | } |
---|
124 | return($returned); |
---|
125 | } |
---|
126 | } |
---|
127 | |
---|
128 | ?> |
---|