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

Last change on this file since 4998 was 4998, checked in by grum, 14 years ago

Small bugs fixed + implementation of "Magic" metadata

  • Property svn:executable set to *
File size: 9.1 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
92      'ShotInfo.Aperture' => Array(
93        'implemented'  => true,
94        'translatable' => false,
95        'tagValues'    => Array(
96          "{exif.exif.FNumber}",
97          "{xmp.exif:FNumber}",
98          "{exif.exif.ApertureValue}",
99          "{xmp.exif:ApertureValue}",
100        )
101      ),
102
103      'ShotInfo.Exposure' => Array(
104        'implemented'  => true,
105        'translatable' => false,
106        'tagValues'    => Array(
107          "{exif.exif.ExposureTime}",
108          "{xmp.exif:ExposureTime}",
109          "{exif.exif.ShutterSpeedValue}",
110          "{xmp.exif:ShutterSpeedValue}",
111        )
112      ),
113
114      'ShotInfo.ISO' => Array(
115        'implemented'  => true,
116        'translatable' => false,
117        'tagValues'    => Array(
118          "{exif.exif.ISOSpeedRatings}",
119          "{exif.Pentax.ISO}",
120          "{exif.Canon.CanonShotInfo.BaseISO}",
121          "{xmp.exif:ISOSpeedRatings}",
122        )
123      ),
124
125      'ShotInfo.FocalLength' => Array(
126        'implemented'  => true,
127        'translatable' => false,
128        'tagValues'    => Array(
129          "{exif.exif.FocalLength}",
130          "{xmp.exif:FocalLength}",
131          "{exif.Pentax.FocalLength}",
132          "{exif.Canon.CanonCameraInfo.FocalLength}",
133        )
134      ),
135
136      'ShotInfo.FocalLengthIn35mm' => Array(
137        'implemented'  => true,
138        'translatable' => false,
139        'tagValues'    => Array(
140          "{exif.exif.FocalLengthIn35mm}",
141          "{xmp.exif:FocalLengthIn35mm}",
142        )
143      ),
144
145      'ShotInfo.Lens' => Array(
146        'implemented'  => true,
147        'translatable' => false,
148        'tagValues'    => Array(
149          "{exif.Pentax.LensType}",
150          "{exif.Nikon.Lens}",
151          "{exif.Canon.CanonCameraSettings.LensType}",
152          "{exif.Canon.CanonCameraInfo.LensType}",
153          "{xmp.aux:Lens}",
154          "{xmp.aux:LensID}", // work with the Xmp LensId is not the best way to
155                              // know the lens (all data needed to find the
156                              // exact lens are not available in xmp metadata)
157        )
158      ),
159
160      'ShotInfo.DateTime' => Array(
161        'implemented'  => true,
162        'translatable' => false,
163        'tagValues'    => Array(
164          "{exif.exif.DateTimeOriginal}",
165          "{exif.exif.DateTimeDigitized}",
166          "{xmp.exif:DateTimeOriginal}",
167          "{xmp.exif:DateTimeDigitized}",
168        )
169      ),
170
171      'ShotInfo.Flash.Fired' => Array(
172        'implemented'  => true,
173        'translatable' => true,
174        'tagValues'    => Array(
175          "{exif.exif.Flash[detail[0]]}",
176          "{xmp.exif:Fired}",
177        )
178      ),
179
180      'ShotInfo.Flash.RedEyeMode' => Array(
181        'implemented'  => true,
182        'translatable' => true,
183        'tagValues'    => Array(
184          "{exif.exif.Flash[detail[4]]}",
185          "{xmp.exif:RedEyeMode}",
186        )
187      ),
188
189
190      'Image.Width' => Array(
191        'implemented'  => true,
192        'translatable' => false,
193        'tagValues'    => Array(
194          "{exif.exif.PixelXDimension}",
195          "{exif.tiff.ImageWidth}",
196          "{xmp.exif:PixelXDimension}",
197          "{xmp.tiff:ImageWidth}",
198        )
199      ),
200
201      'Image.Height' => Array(
202        'implemented'  => true,
203        'translatable' => false,
204        'tagValues'    => Array(
205          "{exif.exif.PixelYDimension}",
206          "{exif.tiff.ImageHeight}",
207          "{xmp.exif:PixelYDimension}",
208          "{xmp.tiff:ImageHeight}",
209        )
210      ),
211
212      'Image.Dimension' => Array(
213        'implemented'  => true,
214        'translatable' => false,
215        'tagValues' => Array(
216          "{magic.Image.Width}x{magic.Image.Height}"
217        )
218      ),
219
220      'Author.ImageTitle' => Array(
221        'implemented'  => true,
222        'translatable' => false,
223        'tagValues' => Array(
224          "{xmp.dc:title}",
225          "{exif.tiff.ImageDescription}",
226          "{iptc.Object Name}",
227        )
228      ),
229
230      'Author.Artist' => Array(
231        'implemented'  => true,
232        'translatable' => false,
233        'tagValues' => Array(
234          "{xmp.dc:creator[values]}",
235          "{exif.tiff.Artist}",
236          "{iptc.Writer/Editor}",
237        )
238      ),
239
240      'Author.Copyright' => Array(
241        'implemented'  => true,
242        'translatable' => false,
243        'tagValues' => Array(
244          "{xmp.dc:rights}",
245          "{exif.tiff.Copyright}",
246          "{iptc.Copyright Notice}"
247        )
248      ),
249
250      'Author.Comment' => Array(
251        'implemented'  => true,
252        'translatable' => false,
253        'tagValues' => Array(
254          "{xmp.dc:description}",
255          "{iptc.Caption/Abstract}",
256          "{exif.exif.UserComment}",
257        )
258      ),
259
260      'Processing.PostProcessingSoftware' => Array(
261        'implemented'  => true,
262        'translatable' => false,
263        'tagValues' => Array(
264          "{exif.tiff.ProcessingSoftware}",
265          "{exif.tiff.Software}",
266          "{xmp.tiff:Software}",
267          "{xmp.xmp:CreatorTool}",
268          "{iptc.Originating Program} {iptc.Program Version}",
269        )
270      ),
271
272      'Processing.Software' => Array(
273        'implemented'  => true,
274        'translatable' => false,
275        'tagValues' => Array(
276          "{exif.tiff.Software}",
277          "{xmp.tiff:Software}",
278          "{xmp.dc:CreatorTool}",
279          "{exif.Canon.CanonFirmwareVersion}",
280        )
281      ),
282
283      'Processing.OriginalFileName' => Array(
284        'implemented'  => true,
285        'translatable' => false,
286        'tagValues' => Array(
287          "{exif.tiff.DocumentName}",
288          "{xmp.crs:RawFileName}",
289        )
290      ),
291
292      'Processing.PostProcessingDateTime' => Array(
293        'implemented'  => true,
294        'translatable' => false,
295        'tagValues' => Array(
296          "{exif.tiff.DateTime}",
297          "{xmp.xmp:ModifyDate}",
298        )
299      ),
300
301    );
302
303
304    function __destruct()
305    {
306      parent::__destruct();
307    }
308
309  }
310
311
312?>
Note: See TracBrowser for help on using the repository browser.