source: extensions/AMetaData/JpegMetaData/TagDefinitions/MagicTags.class.php @ 7511

Last change on this file since 7511 was 7511, checked in by grum, 13 years ago

Update JpegMetadata class to implement COM segment as a tag and keywords in "magic" tags
feature:1975, feature:1976

  • Property svn:executable set to *
File size: 10.7 KB
Line 
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 MagicTags is the definition of the computed JpegMetadata tags
36 *
37 * -----------------------------------------------------------------------------
38 *
39 * .. Notes ..
40 *
41 * The MagicTags class is derived from the KnownTags class.
42 *
43 * ======> See KnownTags.class.php to know more about the tag definitions <=====
44 *
45 */
46
47  require_once(JPEG_METADATA_DIR."TagDefinitions/KnownTags.class.php");
48
49  /**
50   * Define the "magic" JpegMetadata computed tags
51   *
52   * all tag are defined by a list of metadata
53   *
54   * all metadata are searched in the given list order by their name : if a
55   * given metadata in is not found in the image, the next is searched.
56   *
57   * in most case, according with the Xmp specification, list are defined in
58   * this order :
59   *  - exif tags
60   *  - iptc tags
61   *  - xmp tags
62   *
63   * In some case, the Xmp metadata are in the first place of the list, because
64   * Xmp allows to UTF-8 string and we can consider that if there is exif & xmp
65   * data, the localized UTF-8 is most important
66   *
67   */
68  class MagicTags extends KnownTags
69  {
70    protected $label = "Magic JpegMetadata computed tags";
71    protected $tags = Array(
72
73      'Camera.Make' => Array(
74        'implemented'  => true,
75        'translatable' => false,
76        'tagValues'    => Array(
77          "{exif.tiff.Make}",
78          "{xmp.tiff:Make}",
79        )
80      ),
81
82      'Camera.Model' => Array(
83        'implemented'  => true,
84        'translatable' => false,
85        'tagValues'    => Array(
86          "{exif.tiff.Model}",
87          "{xmp.tiff:Model}",
88        )
89      ),
90
91      'ShotInfo.Aperture' => Array(
92        'implemented'  => true,
93        'translatable' => false,
94        'tagValues'    => Array(
95          "{exif.exif.FNumber}",
96          "{xmp.exif:FNumber}",
97          "{exif.exif.ApertureValue}",
98          "{xmp.exif:ApertureValue}",
99        )
100      ),
101
102      'ShotInfo.Exposure' => Array(
103        'implemented'  => true,
104        'translatable' => false,
105        'tagValues'    => Array(
106          "{exif.exif.ExposureTime}",
107          "{xmp.exif:ExposureTime}",
108          "{exif.exif.ShutterSpeedValue}",
109          "{xmp.exif:ShutterSpeedValue}",
110        )
111      ),
112
113      'ShotInfo.ISO' => Array(
114        'implemented'  => true,
115        'translatable' => false,
116        'tagValues'    => Array(
117          "{exif.exif.ISOSpeedRatings}",
118          "{xmp.exif:ISOSpeedRatings[values]}",
119          "{exif.Pentax.ISO}",
120        )
121      ),
122
123      'ShotInfo.FocalLength' => Array(
124        'implemented'  => true,
125        'translatable' => false,
126        'tagValues'    => Array(
127          "{exif.exif.FocalLength}",
128          "{xmp.exif:FocalLength}",
129          "{exif.Pentax.FocalLength}",
130          "{exif.Canon.CanonCameraInfo.FocalLength}",
131        )
132      ),
133
134      'ShotInfo.FocalLengthIn35mm' => Array(
135        'implemented'  => true,
136        'translatable' => false,
137        'tagValues'    => Array(
138          "{exif.exif.FocalLengthIn35mmFilm}",
139          "{xmp.exif:FocalLengthIn35mmFilm}",
140        )
141      ),
142
143      'ShotInfo.Lens' => Array(
144        'implemented'  => true,
145        'translatable' => false,
146        'tagValues'    => Array(
147          "{exif.Pentax.LensType}",
148          "{exif.Nikon.LensData}",
149          "{exif.Nikon.Lens}",
150          "{exif.Canon.CanonCameraSettings.LensType}",
151          "{exif.Canon.CanonCameraInfo.LensType}",
152          "{xmp.aux:Lens}",
153          "{xmp.aux:LensID}", // work with the Xmp LensId is not the best way to
154                              // know the lens (all data needed to find the
155                              // exact lens are not available in xmp metadata)
156        )
157      ),
158
159      'ShotInfo.DateTime' => Array(
160        'implemented'  => true,
161        'translatable' => false,
162        'tagValues'    => Array(
163          "{exif.exif.DateTimeOriginal}",
164          "{exif.exif.DateTimeDigitized}",
165          "{xmp.exif:DateTimeOriginal}",
166          "{xmp.exif:DateTimeDigitized}",
167        )
168      ),
169
170      'ShotInfo.Flash.Fired' => Array(
171        'implemented'  => true,
172        'translatable' => true,
173        'tagValues'    => Array(
174          "{exif.exif.Flash[detail[0]]}",
175          "{xmp.exif:Fired}",
176        )
177      ),
178
179      'ShotInfo.Flash.RedEyeMode' => Array(
180        'implemented'  => true,
181        'translatable' => true,
182        'tagValues'    => Array(
183          "{exif.exif.Flash[detail[4]]}",
184          "{xmp.exif:RedEyeMode}",
185        )
186      ),
187
188
189      'Image.Width' => Array(
190        'implemented'  => true,
191        'translatable' => false,
192        'tagValues'    => Array(
193          "{exif.exif.PixelXDimension}",
194          "{exif.tiff.ImageWidth}",
195          "{xmp.exif:PixelXDimension}",
196          "{xmp.tiff:ImageWidth}",
197        )
198      ),
199
200      'Image.Height' => Array(
201        'implemented'  => true,
202        'translatable' => false,
203        'tagValues'    => Array(
204          "{exif.exif.PixelYDimension}",
205          "{exif.tiff.ImageHeight}",
206          "{xmp.exif:PixelYDimension}",
207          "{xmp.tiff:ImageHeight}",
208        )
209      ),
210
211      'Image.Dimension' => Array(
212        'implemented'  => true,
213        'translatable' => false,
214        'tagValues' => Array(
215          "{magic.Image.Width}x{magic.Image.Height}"
216        )
217      ),
218
219      'Author.ImageTitle' => Array(
220        'implemented'  => true,
221        'translatable' => false,
222        'tagValues' => Array(
223          "{xmp.dc:title}",
224          "{exif.tiff.ImageDescription}",
225          "{iptc.Object Name}",
226        )
227      ),
228
229      'Author.Artist' => Array(
230        'implemented'  => true,
231        'translatable' => false,
232        'tagValues' => Array(
233          "{xmp.dc:creator[values]}",
234          "{exif.tiff.Artist}",
235          "{iptc.Writer/Editor}",
236        )
237      ),
238
239      'Author.Copyright' => Array(
240        'implemented'  => true,
241        'translatable' => false,
242        'tagValues' => Array(
243          "{xmp.dc:rights}",
244          "{exif.tiff.Copyright}",
245          "{iptc.Copyright Notice}"
246        )
247      ),
248
249      'Author.Comment' => Array(
250        'implemented'  => true,
251        'translatable' => false,
252        'tagValues' => Array(
253          "{xmp.dc:description}",
254          "{iptc.Caption/Abstract}",
255          "{exif.exif.UserComment}",
256          "{com.comment}"
257        )
258      ),
259
260      'Author.Keywords' => Array(
261        'implemented'  => true,
262        'translatable' => false,
263        'tagValues' => Array(
264          "{xmp.dc:subject[values]},{iptc.Keywords[values]},{xmp.digiKam:TagsList[values]},{xmp.lr:hierarchicalSubject[values]}"
265        )
266      ),
267
268      'Processing.PostProcessingSoftware' => Array(
269        'implemented'  => true,
270        'translatable' => false,
271        'tagValues' => Array(
272          "{exif.tiff.ProcessingSoftware}",
273          "{exif.tiff.Software}",
274          "{xmp.tiff:Software}",
275          "{xmp.xmp:CreatorTool}",
276          "{iptc.Originating Program} {iptc.Program Version}",
277        )
278      ),
279
280      'Processing.Software' => Array(
281        'implemented'  => true,
282        'translatable' => false,
283        'tagValues' => Array(
284          "{exif.tiff.Software}",
285          "{xmp.tiff:Software}",
286          "{xmp.dc:CreatorTool}",
287          "{exif.Canon.CanonFirmwareVersion}",
288        )
289      ),
290
291      'Processing.OriginalFileName' => Array(
292        'implemented'  => true,
293        'translatable' => false,
294        'tagValues' => Array(
295          "{exif.tiff.DocumentName}",
296          "{xmp.crs:RawFileName}",
297        )
298      ),
299
300      'Processing.PostProcessingDateTime' => Array(
301        'implemented'  => true,
302        'translatable' => false,
303        'tagValues' => Array(
304          "{exif.tiff.DateTime}",
305          "{xmp.xmp:ModifyDate}",
306        )
307      ),
308
309      'GPS.Altitude' => Array(
310        'implemented'  => true,
311        'translatable' => true,
312        'tagValues' => Array(
313          "{exif.gps.GPSAltitudeRef}|{exif.gps.GPSAltitude}m",
314          "{xmp.exif:GPSAltitudeRef}|{xmp.exif:GPSAltitude}m",
315        )
316      ),
317
318      'GPS.Latitude' => Array(
319        'implemented'  => true,
320        'translatable' => true,
321        'tagValues' => Array(
322          "{exif.gps.GPSLatitude}| |{exif.gps.GPSLatitudeRef}",
323          "{xmp.exif:GPSLatitude}",
324        )
325      ),
326
327      'GPS.Longitude' => Array(
328        'implemented'  => true,
329        'translatable' => true,
330        'tagValues' => Array(
331          "{exif.gps.GPSLongitude}| |{exif.gps.GPSLongitudeRef}",
332          "{xmp.exif:GPSLongitude}",
333        )
334      ),
335
336      'GPS.Localization' => Array(
337        'implemented'  => true,
338        'translatable' => true,
339        'tagValues' => Array(
340          "{magic.GPS.Latitude}|, |{magic.GPS.Longitude}"
341        )
342      ),
343
344      'GPS.LatitudeNum' => Array(
345        'implemented'  => true,
346        'translatable' => false,
347        'tagValues' => Array(
348          "{magic.GPS.Latitude}"
349        )
350      ),
351
352      'GPS.LongitudeNum' => Array(
353        'implemented'  => true,
354        'translatable' => false,
355        'tagValues' => Array(
356          "{magic.GPS.Longitude}"
357        )
358      ),
359
360
361
362
363    );
364
365
366    function __destruct()
367    {
368      parent::__destruct();
369    }
370
371  }
372
373
374?>
Note: See TracBrowser for help on using the repository browser.