4 * PEL: PHP Exif Library.
5 * A library with support for reading and
6 * writing all Exif headers in JPEG and TIFF images using PHP.
8 * Copyright (C) 2004, 2005, 2006, 2007 Martin Geisler.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program in the file COPYING; if not, write to the
22 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
23 * Boston, MA 02110-1301 USA
25 namespace lsolesen\pel;
28 * Namespace for functions operating on Exif tags.
30 * @author Martin Geisler <mgeisler@users.sourceforge.net>
31 * @license http://www.gnu.org/licenses/gpl.html GNU General Public
37 * Class with static methods for Exif tags.
39 * This class defines the constants that represents the Exif tags
40 * known to PEL. They are supposed to be used whenever one needs to
41 * specify an Exif tag, and they will be denoted by the pseudo-type
42 * {@link PelTag} throughout the documentation.
44 * Please note that the constrains on the format and number of
45 * components given here are advisory only. To follow the Exif
46 * specification one should obey them, but there is nothing that
47 * prevents you from creating an {@link IMAGE_LENGTH} entry with two
48 * or more components, even though the standard says that there should
49 * be exactly one component.
51 * All the methods in this class are static and should be called with
52 * the Exif tag on which they should operate.
54 * @author Martin Geisler <mgeisler@users.sourceforge.net>
61 * Interoperability index.
63 * Format: {@link PelFormat::ASCII}.
67 const INTEROPERABILITY_INDEX = 0x0001;
70 * Interoperability version.
72 * Format: {@link PelFormat::UNDEFINED}.
76 const INTEROPERABILITY_VERSION = 0x0002;
81 * Format: {@link PelFormat::SHORT} or {@link PelFormat::LONG}.
85 const IMAGE_WIDTH = 0x0100;
90 * Format: {@link PelFormat::SHORT} or {@link PelFormat::LONG}.
94 const IMAGE_LENGTH = 0x0101;
97 * Number of bits per component.
99 * Format: {@link PelFormat::SHORT}.
103 const BITS_PER_SAMPLE = 0x0102;
106 * Compression scheme.
108 * Format: {@link PelFormat::SHORT}.
112 const COMPRESSION = 0x0103;
117 * Format: {@link PelFormat::SHORT}.
121 const PHOTOMETRIC_INTERPRETATION = 0x0106;
128 * Components: Unknown.
130 const FILL_ORDER = 0x010A;
135 * Format: {@link PelEntryAscii}.
137 * Components: any number.
139 const DOCUMENT_NAME = 0x010D;
144 * Format: {@link PelEntryAscii}.
146 * Components: any number.
148 const IMAGE_DESCRIPTION = 0x010E;
153 * Format: {@link PelEntryAscii}.
155 * Components: any number.
162 * Format: {@link PelFormat::ASCII}.
164 * Components: any number.
166 const MODEL = 0x0110;
171 * Format: {@link PelFormat::SHORT} or {@link PelFormat::LONG}.
173 * Components: any number.
175 const STRIP_OFFSETS = 0x0111;
178 * Orientation of image.
180 * Format: {@link PelFormat::SHORT}.
184 const ORIENTATION = 0x0112;
187 * Number of components.
189 * Format: {@link PelFormat::SHORT}.
193 const SAMPLES_PER_PIXEL = 0x0115;
198 * Format: {@link PelFormat::SHORT} or {@link PelFormat::LONG}.
202 const ROWS_PER_STRIP = 0x0116;
207 * Format: {@link PelFormat::SHORT} or {@link PelFormat::LONG}.
209 * Components: any number.
211 const STRIP_BYTE_COUNTS = 0x0117;
214 * Image resolution in width direction.
216 * Format: {@link PelFormat::RATIONAL}.
220 const X_RESOLUTION = 0x011A;
223 * Image resolution in height direction.
225 * Format: {@link PelFormat::RATIONAL}.
229 const Y_RESOLUTION = 0x011B;
232 * Image data arrangement.
234 * Format: {@link PelFormat::SHORT}.
238 const PLANAR_CONFIGURATION = 0x011C;
241 * Unit of X and Y resolution.
243 * Format: {@link PelFormat::SHORT}.
247 const RESOLUTION_UNIT = 0x0128;
252 * Format: {@link PelFormat::SHORT}.
256 const TRANSFER_FUNCTION = 0x012D;
261 * Format: {@link PelFormat::ASCII}.
263 * Components: any number.
265 const SOFTWARE = 0x0131;
268 * File change date and time.
270 * Format: {@link PelFormat::ASCII}, modelled by the {@link
271 * PelEntryTime} class.
275 const DATE_TIME = 0x0132;
278 * Person who created the image.
280 * Format: {@link PelFormat::ASCII}.
282 * Components: any number.
284 const ARTIST = 0x013B;
287 * White point chromaticity.
289 * Format: {@link PelFormat::RATIONAL}.
293 const WHITE_POINT = 0x013E;
296 * Chromaticities of primaries.
298 * Format: {@link PelFormat::RATIONAL}.
302 const PRIMARY_CHROMATICITIES = 0x013F;
309 * Components: Unknown.
311 const TRANSFER_RANGE = 0x0156;
318 * Components: Unknown.
320 const JPEG_PROC = 0x0200;
323 * Offset to JPEG SOI.
325 * Format: {@link PelFormat::LONG}.
329 const JPEG_INTERCHANGE_FORMAT = 0x0201;
332 * Bytes of JPEG data.
334 * Format: {@link PelFormat::LONG}.
338 const JPEG_INTERCHANGE_FORMAT_LENGTH = 0x0202;
341 * Color space transformation matrix coefficients.
343 * Format: {@link PelFormat::RATIONAL}.
347 const YCBCR_COEFFICIENTS = 0x0211;
350 * Subsampling ratio of Y to C.
352 * Format: {@link PelFormat::SHORT}.
356 const YCBCR_SUB_SAMPLING = 0x0212;
359 * Y and C positioning.
361 * Format: {@link PelFormat::SHORT}.
365 const YCBCR_POSITIONING = 0x0213;
368 * Pair of black and white reference values.
370 * Format: {@link PelFormat::RATIONAL}.
374 const REFERENCE_BLACK_WHITE = 0x0214;
377 * Related Image File Format
381 * Components: Unknown.
383 const RELATED_IMAGE_FILE_FORMAT = 0x1000;
386 * Related Image Width
388 * Format: Unknown, probably {@link PelFormat::SHORT}?
390 * Components: Unknown, probably 1.
392 const RELATED_IMAGE_WIDTH = 0x1001;
395 * Related Image Length
397 * Format: Unknown, probably {@link PelFormat::SHORT}?
399 * Components: Unknown, probably 1.
401 const RELATED_IMAGE_LENGTH = 0x1002;
406 * Format: {@link PelFormat::SHORT}
410 const RATING = 0x4746;
413 * CFA Repeat Pattern Dim.
415 * Format: {@link PelFormat::SHORT}.
419 const CFA_REPEAT_PATTERN_DIM = 0x828D;
426 * Components: Unknown.
428 const BATTERY_LEVEL = 0x828F;
433 * Format: {@link PelFormat::ASCII}, modelled by the {@link
434 * PelEntryCopyright} class.
436 * Components: any number.
438 const COPYRIGHT = 0x8298;
443 * Format: {@link PelFormat::RATIONAL}.
447 const EXPOSURE_TIME = 0x829A;
452 * Format: {@link PelFormat::RATIONAL}.
456 const FNUMBER = 0x829D;
461 * Format: {@link PelFormat::LONG}.
463 * Components: any number.
465 const IPTC_NAA = 0x83BB;
470 * Format: {@link PelFormat::LONG}.
474 const EXIF_IFD_POINTER = 0x8769;
477 * Inter Color Profile
479 * Format: {@link PelFormat::UNDEFINED}.
481 * Components: any number.
483 const INTER_COLOR_PROFILE = 0x8773;
488 * Format: {@link PelFormat::SHORT}.
492 const EXPOSURE_PROGRAM = 0x8822;
495 * Spectral Sensitivity
497 * Format: {@link PelFormat::ASCII}.
499 * Components: any number.
501 const SPECTRAL_SENSITIVITY = 0x8824;
504 * GPS Info IFD Pointer
506 * Format: {@link PelFormat::LONG}.
510 const GPS_INFO_IFD_POINTER = 0x8825;
515 * Format: {@link PelFormat::SHORT}.
519 const ISO_SPEED_RATINGS = 0x8827;
524 * Format: {@link PelFormat::UNDEFINED}.
526 * Components: any number.
533 * Format: {@link PelFormat::UNDEFINED}, modelled by the {@link
534 * PelEntryVersion} class.
538 const EXIF_VERSION = 0x9000;
541 * Date and time of original data generation.
543 * Format: {@link PelFormat::ASCII}, modelled by the {@link
544 * PelEntryTime} class.
548 const DATE_TIME_ORIGINAL = 0x9003;
551 * Date and time of digital data generation.
553 * Format: {@link PelFormat::ASCII}, modelled by the {@link
554 * PelEntryTime} class.
558 const DATE_TIME_DIGITIZED = 0x9004;
561 * Meaning of each component.
563 * Format: {@link PelFormat::UNDEFINED}.
567 const COMPONENTS_CONFIGURATION = 0x9101;
570 * Image compression mode.
572 * Format: {@link PelFormat::RATIONAL}.
576 const COMPRESSED_BITS_PER_PIXEL = 0x9102;
581 * Format: {@link PelFormat::SRATIONAL}.
585 const SHUTTER_SPEED_VALUE = 0x9201;
590 * Format: {@link PelFormat::RATIONAL}.
594 const APERTURE_VALUE = 0x9202;
599 * Format: {@link PelFormat::SRATIONAL}.
603 const BRIGHTNESS_VALUE = 0x9203;
608 * Format: {@link PelFormat::SRATIONAL}.
612 const EXPOSURE_BIAS_VALUE = 0x9204;
617 * Format: {@link PelFormat::RATIONAL}.
621 const MAX_APERTURE_VALUE = 0x9205;
626 * Format: {@link PelFormat::SRATIONAL}.
630 const SUBJECT_DISTANCE = 0x9206;
635 * Format: {@link PelFormat::SHORT}.
639 const METERING_MODE = 0x9207;
644 * Format: {@link PelFormat::SHORT}.
648 const LIGHT_SOURCE = 0x9208;
653 * Format: {@link PelFormat::SHORT}.
657 const FLASH = 0x9209;
662 * Format: {@link PelFormat::RATIONAL}.
666 const FOCAL_LENGTH = 0x920A;
671 * Format: {@link PelFormat::SHORT}.
675 const SUBJECT_AREA = 0x9214;
680 * Format: {@link PelFormat::UNDEFINED}.
682 * Components: any number.
684 const MAKER_NOTE = 0x927C;
689 * Format: {@link PelFormat::UNDEFINED}, modelled by the {@link
690 * PelEntryUserComment} class.
692 * Components: any number.
694 const USER_COMMENT = 0x9286;
699 * Format: {@link PelFormat::ASCII}.
701 * Components: any number.
703 const SUB_SEC_TIME = 0x9290;
706 * SubSec Time Original
708 * Format: {@link PelFormat::ASCII}.
710 * Components: any number.
712 const SUB_SEC_TIME_ORIGINAL = 0x9291;
715 * SubSec Time Digitized
717 * Format: {@link PelFormat::ASCII}.
719 * Components: any number.
721 const SUB_SEC_TIME_DIGITIZED = 0x9292;
726 * Format: {@link PelFormat::BYTE}, modelled by the
727 * {@link PelEntryWindowsString} class.
729 * Components: any number.
731 const XP_TITLE = 0x9C9B;
736 * Format: {@link PelFormat::BYTE}, modelled by the
737 * {@link PelEntryWindowsString} class.
739 * Components: any number.
741 const XP_COMMENT = 0x9C9C;
746 * Format: {@link PelFormat::BYTE}, modelled by the
747 * {@link PelEntryWindowsString} class.
749 * Components: any number.
751 const XP_AUTHOR = 0x9C9D;
754 * Windows XP Keywords
756 * Format: {@link PelFormat::BYTE}, modelled by the
757 * {@link PelEntryWindowsString} class.
759 * Components: any number.
761 const XP_KEYWORDS = 0x9C9E;
766 * Format: {@link PelFormat::BYTE}, modelled by the
767 * {@link PelEntryWindowsString} class.
769 * Components: any number.
771 const XP_SUBJECT = 0x9C9F;
774 * Supported Flashpix version
776 * Format: {@link PelFormat::UNDEFINED}, modelled by the {@link
777 * PelEntryVersion} class.
781 const FLASH_PIX_VERSION = 0xA000;
784 * Color space information.
786 * Format: {@link PelFormat::SHORT}.
790 const COLOR_SPACE = 0xA001;
795 * Format: {@link PelFormat::SHORT} or {@link PelFormat::LONG}.
799 const PIXEL_X_DIMENSION = 0xA002;
802 * Valid image height.
804 * Format: {@link PelFormat::SHORT} or {@link PelFormat::LONG}.
808 const PIXEL_Y_DIMENSION = 0xA003;
811 * Related audio file.
813 * Format: {@link PelFormat::ASCII}.
815 * Components: any number.
817 const RELATED_SOUND_FILE = 0xA004;
820 * Interoperability IFD Pointer
822 * Format: {@link PelFormat::LONG}.
826 const INTEROPERABILITY_IFD_POINTER = 0xA005;
831 * Format: {@link PelFormat::RATIONAL}.
835 const FLASH_ENERGY = 0xA20B;
838 * Spatial frequency response.
840 * Format: {@link PelFormat::UNDEFINED}.
842 * Components: any number.
844 const SPATIAL_FREQUENCY_RESPONSE = 0xA20C;
847 * Focal plane X resolution.
849 * Format: {@link PelFormat::RATIONAL}.
853 const FOCAL_PLANE_X_RESOLUTION = 0xA20E;
856 * Focal plane Y resolution.
858 * Format: {@link PelFormat::RATIONAL}.
862 const FOCAL_PLANE_Y_RESOLUTION = 0xA20F;
865 * Focal plane resolution unit.
867 * Format: {@link PelFormat::SHORT}.
871 const FOCAL_PLANE_RESOLUTION_UNIT = 0xA210;
876 * Format: {@link PelFormat::SHORT}.
880 const SUBJECT_LOCATION = 0xA214;
885 * Format: {@link PelFormat::RATIONAL}.
889 const EXPOSURE_INDEX = 0xA215;
894 * Format: {@link PelFormat::SHORT}.
898 const SENSING_METHOD = 0xA217;
903 * Format: {@link PelFormat::UNDEFINED}.
907 const FILE_SOURCE = 0xA300;
912 * Format: {@link PelFormat::UNDEFINED}.
916 const SCENE_TYPE = 0xA301;
921 * Format: {@link PelFormat::UNDEFINED}.
923 * Components: any number.
925 const CFA_PATTERN = 0xA302;
928 * Custom image processing.
930 * Format: {@link PelFormat::SHORT}.
934 const CUSTOM_RENDERED = 0xA401;
939 * Format: {@link PelFormat::SHORT}.
943 const EXPOSURE_MODE = 0xA402;
948 * Format: {@link PelFormat::SHORT}.
952 const WHITE_BALANCE = 0xA403;
955 * Digital zoom ratio.
957 * Format: {@link PelFormat::RATIONAL}.
961 const DIGITAL_ZOOM_RATIO = 0xA404;
964 * Focal length in 35mm film.
966 * Format: {@link PelFormat::RATIONAL}.
970 const FOCAL_LENGTH_IN_35MM_FILM = 0xA405;
973 * Scene capture type.
975 * Format: {@link PelFormat::SHORT}.
979 const SCENE_CAPTURE_TYPE = 0xA406;
984 * Format: {@link PelFormat::SHORT}.
988 const GAIN_CONTROL = 0xA407;
993 * Format: {@link PelFormat::SHORT}.
997 const CONTRAST = 0xA408;
1002 * Format: {@link PelFormat::SHORT}.
1006 const SATURATION = 0xA409;
1011 * Format: {@link PelFormat::SHORT}.
1015 const SHARPNESS = 0xA40A;
1018 * Device settings description.
1020 * This tag indicates information on the picture-taking conditions
1021 * of a particular camera model. The tag is used only to indicate
1022 * the picture-taking conditions in the reader.
1024 const DEVICE_SETTING_DESCRIPTION = 0xA40B;
1027 * Subject distance range.
1029 * Format: {@link PelFormat::SHORT}.
1033 const SUBJECT_DISTANCE_RANGE = 0xA40C;
1038 * Format: {@link PelFormat::ASCII}.
1042 const IMAGE_UNIQUE_ID = 0xA420;
1047 * Format: {@link PelFormat::RATIONAL}.
1051 const GAMMA = 0xA500;
1056 * Format: {@link PelFormat::UNDEFINED}.
1058 * Components: unknown.
1060 const PRINT_IM = 0xC4A5;
1065 * Format: {@link PelFormat::BYTE}.
1069 const GPS_VERSION_ID = 0x0000;
1072 * North or South Latitude.
1074 * Format: {@link PelFormat::ASCII}.
1078 const GPS_LATITUDE_REF = 0x0001;
1083 * Format: {@link PelFormat::RATIONAL}.
1087 const GPS_LATITUDE = 0x0002;
1090 * East or West Longitude.
1092 * Format: {@link PelFormat::ASCII}.
1096 const GPS_LONGITUDE_REF = 0x0003;
1101 * Format: {@link PelFormat::RATIONAL}.
1105 const GPS_LONGITUDE = 0x0004;
1108 * Altitude reference.
1110 * Format: {@link PelFormat::BYTE}.
1114 const GPS_ALTITUDE_REF = 0x0005;
1119 * Format: {@link PelFormat::RATIONAL}.
1123 const GPS_ALTITUDE = 0x0006;
1126 * GPS time (atomic clock).
1128 * Format: {@link PelFormat::RATIONAL}.
1132 const GPS_TIME_STAMP = 0x0007;
1135 * GPS satellites used for measurement.
1137 * Format: {@link PelFormat::ASCII}.
1141 const GPS_SATELLITES = 0x0008;
1144 * GPS receiver status.
1146 * Format: {@link PelFormat::ASCII}.
1150 const GPS_STATUS = 0x0009;
1153 * GPS measurement mode.
1155 * Format: {@link PelFormat::ASCII}.
1159 const GPS_MEASURE_MODE = 0x000A;
1162 * Measurement precision.
1164 * Format: {@link PelFormat::RATIONAL}.
1168 const GPS_DOP = 0x000B;
1173 * Format: {@link PelFormat::ASCII}.
1177 const GPS_SPEED_REF = 0x000C;
1180 * Speed of GPS receiver.
1182 * Format: {@link PelFormat::RATIONAL}.
1186 const GPS_SPEED = 0x000D;
1189 * Reference for direction of movement.
1191 * Format: {@link PelFormat::ASCII}.
1195 const GPS_TRACK_REF = 0x000E;
1198 * Direction of movement.
1200 * Format: {@link PelFormat::RATIONAL}.
1204 const GPS_TRACK = 0x000F;
1207 * Reference for direction of image.
1209 * Format: {@link PelFormat::ASCII}.
1213 const GPS_IMG_DIRECTION_REF = 0x0010;
1216 * Direction of image.
1218 * Format: {@link PelFormat::RATIONAL}.
1222 const GPS_IMG_DIRECTION = 0x0011;
1225 * Geodetic survey data used.
1227 * Format: {@link PelFormat::ASCII}.
1231 const GPS_MAP_DATUM = 0x0012;
1234 * Reference for latitude of destination.
1236 * Format: {@link PelFormat::ASCII}.
1240 const GPS_DEST_LATITUDE_REF = 0x0013;
1243 * Latitude of destination.
1245 * Format: {@link PelFormat::RATIONAL}.
1249 const GPS_DEST_LATITUDE = 0x0014;
1252 * Reference for longitude of destination.
1254 * Format: {@link PelFormat::ASCII}.
1258 const GPS_DEST_LONGITUDE_REF = 0x0015;
1261 * Longitude of destination.
1263 * Format: {@link PelFormat::RATIONAL}.
1267 const GPS_DEST_LONGITUDE = 0x0016;
1270 * Reference for bearing of destination.
1272 * Format: {@link PelFormat::ASCII}.
1276 const GPS_DEST_BEARING_REF = 0x0017;
1279 * Bearing of destination.
1281 * Format: {@link PelFormat::RATIONAL}.
1285 const GPS_DEST_BEARING = 0x0018;
1288 * Reference for distance to destination.
1290 * Format: {@link PelFormat::ASCII}.
1294 const GPS_DEST_DISTANCE_REF = 0x0019;
1297 * Distance to destination.
1299 * Format: {@link PelFormat::RATIONAL}.
1303 const GPS_DEST_DISTANCE = 0x001A;
1306 * Name of GPS processing method.
1308 * Format: {@link PelFormat::UNDEFINED}.
1312 const GPS_PROCESSING_METHOD = 0x001B;
1317 * Format: {@link PelFormat::UNDEFINED}.
1321 const GPS_AREA_INFORMATION = 0x001C;
1326 * Format: {@link PelFormat::ASCII}.
1330 const GPS_DATE_STAMP = 0x001D;
1333 * GPS differential correction.
1335 * Format: {@link PelFormat::SHORT}.
1339 const GPS_DIFFERENTIAL = 0x001E;
1342 * Values for tags short names.
1344 protected static $exifTagsShort= array(
1345 self::INTEROPERABILITY_INDEX => 'InteroperabilityIndex',
1346 self::INTEROPERABILITY_VERSION => 'InteroperabilityVersion',
1347 self::IMAGE_WIDTH => 'ImageWidth',
1348 self::IMAGE_LENGTH => 'ImageLength',
1349 self::BITS_PER_SAMPLE => 'BitsPerSample',
1350 self::COMPRESSION => 'Compression',
1351 self::PHOTOMETRIC_INTERPRETATION => 'PhotometricInterpretation',
1352 self::FILL_ORDER => 'FillOrder',
1353 self::DOCUMENT_NAME => 'DocumentName',
1354 self::IMAGE_DESCRIPTION => 'ImageDescription',
1355 self::MAKE => 'Make',
1356 self::MODEL => 'Model',
1357 self::STRIP_OFFSETS => 'StripOffsets',
1358 self::ORIENTATION => 'Orientation',
1359 self::SAMPLES_PER_PIXEL => 'SamplesPerPixel',
1360 self::ROWS_PER_STRIP => 'RowsPerStrip',
1361 self::STRIP_BYTE_COUNTS => 'StripByteCounts',
1362 self::X_RESOLUTION => 'XResolution',
1363 self::Y_RESOLUTION => 'YResolution',
1364 self::PLANAR_CONFIGURATION => 'PlanarConfiguration',
1365 self::RESOLUTION_UNIT => 'ResolutionUnit',
1366 self::TRANSFER_FUNCTION => 'TransferFunction',
1367 self::SOFTWARE => 'Software',
1368 self::DATE_TIME => 'DateTime',
1369 self::ARTIST => 'Artist',
1370 self::WHITE_POINT => 'WhitePoint',
1371 self::PRIMARY_CHROMATICITIES => 'PrimaryChromaticities',
1372 self::TRANSFER_RANGE => 'TransferRange',
1373 self::JPEG_PROC => 'JPEGProc',
1374 self::JPEG_INTERCHANGE_FORMAT => 'JPEGInterchangeFormat',
1375 self::JPEG_INTERCHANGE_FORMAT_LENGTH => 'JPEGInterchangeFormatLength',
1376 self::YCBCR_COEFFICIENTS => 'YCbCrCoefficients',
1377 self::YCBCR_SUB_SAMPLING => 'YCbCrSubSampling',
1378 self::YCBCR_POSITIONING => 'YCbCrPositioning',
1379 self::REFERENCE_BLACK_WHITE => 'ReferenceBlackWhite',
1380 self::RELATED_IMAGE_FILE_FORMAT => 'RelatedImageFileFormat',
1381 self::RELATED_IMAGE_WIDTH => 'RelatedImageWidth',
1382 self::RELATED_IMAGE_LENGTH => 'RelatedImageLength',
1383 self::RATING => 'Rating',
1384 self::CFA_REPEAT_PATTERN_DIM => 'CFARepeatPatternDim',
1385 self::CFA_PATTERN => 'CFAPattern',
1386 self::BATTERY_LEVEL => 'BatteryLevel',
1387 self::COPYRIGHT => 'Copyright',
1388 self::EXPOSURE_TIME => 'ExposureTime',
1389 self::FNUMBER => 'FNumber',
1390 self::IPTC_NAA => 'IPTC/NAA',
1391 self::EXIF_IFD_POINTER => 'ExifIFDPointer',
1392 self::INTER_COLOR_PROFILE => 'InterColorProfile',
1393 self::EXPOSURE_PROGRAM => 'ExposureProgram',
1394 self::SPECTRAL_SENSITIVITY => 'SpectralSensitivity',
1395 self::GPS_INFO_IFD_POINTER => 'GPSInfoIFDPointer',
1396 self::ISO_SPEED_RATINGS => 'ISOSpeedRatings',
1397 self::OECF => 'OECF',
1398 self::EXIF_VERSION => 'ExifVersion',
1399 self::DATE_TIME_ORIGINAL => 'DateTimeOriginal',
1400 self::DATE_TIME_DIGITIZED => 'DateTimeDigitized',
1401 self::COMPONENTS_CONFIGURATION => 'ComponentsConfiguration',
1402 self::COMPRESSED_BITS_PER_PIXEL => 'CompressedBitsPerPixel',
1403 self::SHUTTER_SPEED_VALUE => 'ShutterSpeedValue',
1404 self::APERTURE_VALUE => 'ApertureValue',
1405 self::BRIGHTNESS_VALUE => 'BrightnessValue',
1406 self::EXPOSURE_BIAS_VALUE => 'ExposureBiasValue',
1407 self::MAX_APERTURE_VALUE => 'MaxApertureValue',
1408 self::SUBJECT_DISTANCE => 'SubjectDistance',
1409 self::METERING_MODE => 'MeteringMode',
1410 self::LIGHT_SOURCE => 'LightSource',
1411 self::FLASH => 'Flash',
1412 self::FOCAL_LENGTH => 'FocalLength',
1413 self::MAKER_NOTE => 'MakerNote',
1414 self::USER_COMMENT => 'UserComment',
1415 self::SUB_SEC_TIME => 'SubSecTime',
1416 self::SUB_SEC_TIME_ORIGINAL => 'SubSecTimeOriginal',
1417 self::SUB_SEC_TIME_DIGITIZED => 'SubSecTimeDigitized',
1418 self::XP_TITLE => 'WindowsXPTitle',
1419 self::XP_COMMENT => 'WindowsXPComment',
1420 self::XP_AUTHOR => 'WindowsXPAuthor',
1421 self::XP_KEYWORDS => 'WindowsXPKeywords',
1422 self::XP_SUBJECT => 'WindowsXPSubject',
1423 self::FLASH_PIX_VERSION => 'FlashPixVersion',
1424 self::COLOR_SPACE => 'ColorSpace',
1425 self::PIXEL_X_DIMENSION => 'PixelXDimension',
1426 self::PIXEL_Y_DIMENSION => 'PixelYDimension',
1427 self::RELATED_SOUND_FILE => 'RelatedSoundFile',
1428 self::INTEROPERABILITY_IFD_POINTER => 'InteroperabilityIFDPointer',
1429 self::FLASH_ENERGY => 'FlashEnergy',
1430 self::SPATIAL_FREQUENCY_RESPONSE => 'SpatialFrequencyResponse',
1431 self::FOCAL_PLANE_X_RESOLUTION => 'FocalPlaneXResolution',
1432 self::FOCAL_PLANE_Y_RESOLUTION => 'FocalPlaneYResolution',
1433 self::FOCAL_PLANE_RESOLUTION_UNIT => 'FocalPlaneResolutionUnit',
1434 self::SUBJECT_LOCATION => 'SubjectLocation',
1435 self::EXPOSURE_INDEX => 'ExposureIndex',
1436 self::SENSING_METHOD => 'SensingMethod',
1437 self::FILE_SOURCE => 'FileSource',
1438 self::SCENE_TYPE => 'SceneType',
1439 self::SUBJECT_AREA => 'SubjectArea',
1440 self::CUSTOM_RENDERED => 'CustomRendered',
1441 self::EXPOSURE_MODE => 'ExposureMode',
1442 self::WHITE_BALANCE => 'WhiteBalance',
1443 self::DIGITAL_ZOOM_RATIO => 'DigitalZoomRatio',
1444 self::FOCAL_LENGTH_IN_35MM_FILM => 'FocalLengthIn35mmFilm',
1445 self::SCENE_CAPTURE_TYPE => 'SceneCaptureType',
1446 self::GAIN_CONTROL => 'GainControl',
1447 self::CONTRAST => 'Contrast',
1448 self::SATURATION => 'Saturation',
1449 self::SHARPNESS => 'Sharpness',
1450 self::DEVICE_SETTING_DESCRIPTION => 'DeviceSettingDescription',
1451 self::SUBJECT_DISTANCE_RANGE => 'SubjectDistanceRange',
1452 self::IMAGE_UNIQUE_ID => 'ImageUniqueID',
1453 self::GAMMA => 'Gamma',
1454 self::PRINT_IM => 'PrintIM',
1458 * Values for tags titles.
1460 protected static $exifTagsTitle = array(
1461 self::INTEROPERABILITY_INDEX => 'Interoperability Index',
1462 self::INTEROPERABILITY_VERSION => 'Interoperability Version',
1463 self::IMAGE_WIDTH => 'Image Width',
1464 self::IMAGE_LENGTH => 'Image Length',
1465 self::BITS_PER_SAMPLE => 'Bits per Sample',
1466 self::COMPRESSION => 'Compression',
1467 self::PHOTOMETRIC_INTERPRETATION => 'Photometric Interpretation',
1468 self::FILL_ORDER => 'Fill Order',
1469 self::DOCUMENT_NAME => 'Document Name',
1470 self::IMAGE_DESCRIPTION => 'Image Description',
1471 self::MAKE => 'Manufacturer',
1472 self::MODEL => 'Model',
1473 self::STRIP_OFFSETS => 'Strip Offsets',
1474 self::ORIENTATION => 'Orientation',
1475 self::SAMPLES_PER_PIXEL => 'Samples per Pixel',
1476 self::ROWS_PER_STRIP => 'Rows per Strip',
1477 self::STRIP_BYTE_COUNTS => 'Strip Byte Count',
1478 self::X_RESOLUTION => 'x-Resolution',
1479 self::Y_RESOLUTION => 'y-Resolution',
1480 self::PLANAR_CONFIGURATION => 'Planar Configuration',
1481 self::RESOLUTION_UNIT => 'Resolution Unit',
1482 self::TRANSFER_FUNCTION => 'Transfer Function',
1483 self::SOFTWARE => 'Software',
1484 self::DATE_TIME => 'Date and Time',
1485 self::ARTIST => 'Artist',
1486 self::WHITE_POINT => 'White Point',
1487 self::PRIMARY_CHROMATICITIES => 'Primary Chromaticities',
1488 self::TRANSFER_RANGE => 'Transfer Range',
1489 self::JPEG_PROC => 'JPEG Process',
1490 self::JPEG_INTERCHANGE_FORMAT => 'JPEG Interchange Format',
1491 self::JPEG_INTERCHANGE_FORMAT_LENGTH => 'JPEG Interchange Format Length',
1492 self::YCBCR_COEFFICIENTS => 'YCbCr Coefficients',
1493 self::YCBCR_SUB_SAMPLING => 'YCbCr Sub-Sampling',
1494 self::YCBCR_POSITIONING => 'YCbCr Positioning',
1495 self::REFERENCE_BLACK_WHITE => 'Reference Black/White',
1496 self::RELATED_IMAGE_FILE_FORMAT => 'Related Image File Format',
1497 self::RELATED_IMAGE_WIDTH => 'Related Image Width',
1498 self::RELATED_IMAGE_LENGTH => 'Related Image Length',
1499 self::CFA_REPEAT_PATTERN_DIM => 'CFA Repeat Pattern Dim',
1500 self::CFA_PATTERN => 'CFA Pattern',
1501 self::BATTERY_LEVEL => 'Battery Level',
1502 self::COPYRIGHT => 'Copyright',
1503 self::EXPOSURE_TIME => 'Exposure Time',
1504 self::FNUMBER => 'FNumber',
1505 self::IPTC_NAA => 'IPTC/NAA',
1506 self::EXIF_IFD_POINTER => 'Exif IFD Pointer',
1507 self::INTER_COLOR_PROFILE => 'Inter Color Profile',
1508 self::EXPOSURE_PROGRAM => 'Exposure Program',
1509 self::SPECTRAL_SENSITIVITY => 'Spectral Sensitivity',
1510 self::GPS_INFO_IFD_POINTER => 'GPS Info IFD Pointer',
1511 self::ISO_SPEED_RATINGS => 'ISO Speed Ratings',
1512 self::OECF => 'OECF',
1513 self::EXIF_VERSION => 'Exif Version',
1514 self::DATE_TIME_ORIGINAL => 'Date and Time (original)',
1515 self::DATE_TIME_DIGITIZED => 'Date and Time (digitized)',
1516 self::COMPONENTS_CONFIGURATION => 'Components Configuration',
1517 self::COMPRESSED_BITS_PER_PIXEL => 'Compressed Bits per Pixel',
1518 self::SHUTTER_SPEED_VALUE => 'Shutter speed',
1519 self::APERTURE_VALUE => 'Aperture',
1520 self::BRIGHTNESS_VALUE => 'Brightness',
1521 self::EXPOSURE_BIAS_VALUE => 'Exposure Bias',
1522 self::MAX_APERTURE_VALUE => 'Max Aperture Value',
1523 self::SUBJECT_DISTANCE => 'Subject Distance',
1524 self::METERING_MODE => 'Metering Mode',
1525 self::LIGHT_SOURCE => 'Light Source',
1526 self::FLASH => 'Flash',
1527 self::FOCAL_LENGTH => 'Focal Length',
1528 self::MAKER_NOTE => 'Maker Note',
1529 self::USER_COMMENT => 'User Comment',
1530 self::SUB_SEC_TIME => 'SubSec Time',
1531 self::SUB_SEC_TIME_ORIGINAL => 'SubSec Time Original',
1532 self::SUB_SEC_TIME_DIGITIZED => 'SubSec Time Digitized',
1533 self::XP_TITLE => 'Windows XP Title',
1534 self::XP_COMMENT => 'Windows XP Comment',
1535 self::XP_AUTHOR => 'Windows XP Author',
1536 self::XP_KEYWORDS => 'Windows XP Keywords',
1537 self::XP_SUBJECT => 'Windows XP Subject',
1538 self::FLASH_PIX_VERSION => 'FlashPix Version',
1539 self::COLOR_SPACE => 'Color Space',
1540 self::PIXEL_X_DIMENSION => 'Pixel x-Dimension',
1541 self::PIXEL_Y_DIMENSION => 'Pixel y-Dimension',
1542 self::RELATED_SOUND_FILE => 'Related Sound File',
1543 self::INTEROPERABILITY_IFD_POINTER => 'Interoperability IFD Pointer',
1544 self::FLASH_ENERGY => 'Flash Energy',
1545 self::SPATIAL_FREQUENCY_RESPONSE => 'Spatial Frequency Response',
1546 self::FOCAL_PLANE_X_RESOLUTION => 'Focal Plane x-Resolution',
1547 self::FOCAL_PLANE_Y_RESOLUTION => 'Focal Plane y-Resolution',
1548 self::FOCAL_PLANE_RESOLUTION_UNIT => 'Focal Plane Resolution Unit',
1549 self::SUBJECT_LOCATION => 'Subject Location',
1550 self::EXPOSURE_INDEX => 'Exposure index',
1551 self::SENSING_METHOD => 'Sensing Method',
1552 self::FILE_SOURCE => 'File Source',
1553 self::SCENE_TYPE => 'Scene Type',
1554 self::SUBJECT_AREA => 'Subject Area',
1555 self::CUSTOM_RENDERED => 'Custom Rendered',
1556 self::EXPOSURE_MODE => 'Exposure Mode',
1557 self::WHITE_BALANCE => 'White Balance',
1558 self::DIGITAL_ZOOM_RATIO => 'Digital Zoom Ratio',
1559 self::FOCAL_LENGTH_IN_35MM_FILM => 'Focal Length In 35mm Film',
1560 self::SCENE_CAPTURE_TYPE => 'Scene Capture Type',
1561 self::GAIN_CONTROL => 'Gain Control',
1562 self::CONTRAST => 'Contrast',
1563 self::SATURATION => 'Saturation',
1564 self::SHARPNESS => 'Sharpness',
1565 self::DEVICE_SETTING_DESCRIPTION => 'Device Setting Description',
1566 self::SUBJECT_DISTANCE_RANGE => 'Subject Distance Range',
1567 self::IMAGE_UNIQUE_ID => 'Image Unique ID',
1568 self::GAMMA => 'Gamma',
1569 self::PRINT_IM => 'Print IM',
1573 * Values for gps tags short names.
1575 protected static $gpsTagsShort = array(
1576 self::GPS_VERSION_ID => 'GPSVersionID',
1577 self::GPS_LATITUDE_REF => 'GPSLatitudeRef',
1578 self::GPS_LATITUDE => 'GPSLatitude',
1579 self::GPS_LONGITUDE_REF => 'GPSLongitudeRef',
1580 self::GPS_LONGITUDE => 'GPSLongitude',
1581 self::GPS_ALTITUDE_REF => 'GPSAltitudeRef',
1582 self::GPS_ALTITUDE => 'GPSAltitude',
1583 self::GPS_TIME_STAMP => 'GPSTimeStamp',
1584 self::GPS_SATELLITES => 'GPSSatellites',
1585 self::GPS_STATUS => 'GPSStatus',
1586 self::GPS_MEASURE_MODE => 'GPSMeasureMode',
1587 self::GPS_DOP => 'GPSDOP',
1588 self::GPS_SPEED_REF => 'GPSSpeedRef',
1589 self::GPS_SPEED => 'GPSSpeed',
1590 self::GPS_TRACK_REF => 'GPSTrackRef',
1591 self::GPS_TRACK => 'GPSTrack',
1592 self::GPS_IMG_DIRECTION_REF => 'GPSImgDirectionRef',
1593 self::GPS_IMG_DIRECTION => 'GPSImgDirection',
1594 self::GPS_MAP_DATUM => 'GPSMapDatum',
1595 self::GPS_DEST_LATITUDE_REF => 'GPSDestLatitudeRef',
1596 self::GPS_DEST_LATITUDE => 'GPSDestLatitude',
1597 self::GPS_DEST_LONGITUDE_REF => 'GPSDestLongitudeRef',
1598 self::GPS_DEST_LONGITUDE => 'GPSDestLongitude',
1599 self::GPS_DEST_BEARING_REF => 'GPSDestBearingRef',
1600 self::GPS_DEST_BEARING => 'GPSDestBearing',
1601 self::GPS_DEST_DISTANCE_REF => 'GPSDestDistanceRef',
1602 self::GPS_DEST_DISTANCE => 'GPSDestDistance',
1603 self::GPS_PROCESSING_METHOD => 'GPSProcessingMethod',
1604 self::GPS_AREA_INFORMATION => 'GPSAreaInformation',
1605 self::GPS_DATE_STAMP => 'GPSDateStamp',
1606 self::GPS_DIFFERENTIAL => 'GPSDifferential',
1610 * Returns a string from container with key $tag and subcontainer index of $idx
1612 * @param array $container
1613 * {@link PelTag::EXIF_TAGS_SHORT}, {@link PelTag::EXIF_TAGS_TITLE},
1614 * {@link PelTag::GPS_TAGS_SHORT} or {@link PelTag::GPS_TAGS_TITLE} container.
1615 * @param PelTag $tag
1618 * @return string short name or long name of the tag.
1620 public static function getValue($container, $tag)
1622 if (isset($container[ $tag ])) {
1623 return $container[ $tag ];
1626 return self::unknownTag($tag);
1630 * Reverse lookup of a tag id by its short name. Return false for the unknown tag name.
1632 * @param string $name
1635 * @return mixed (bool|int)
1638 public static function getTagByName($name)
1640 $k = array_search($name, self::$exifTagsShort);
1645 return array_search($name, static::$gpsTagsShort);
1649 * Returns string defining unknown tag.
1655 * description string.
1657 protected static function unknownTag($tag)
1659 return Pel::fmt('Unknown: 0x%04X', $tag);
1663 * Returns a short name for an Exif tag.
1666 * the IFD type of the tag, one of {@link PelIfd::IFD0},
1667 * {@link PelIfd::IFD1}, {@link PelIfd::EXIF}, {@link PelIfd::GPS},
1668 * or {@link PelIfd::INTEROPERABILITY}.
1670 * @param PelTag $tag
1673 * @return string the short name of the tag, e.g., 'ImageWidth' for
1674 * the {@link IMAGE_WIDTH} tag. If the tag is not known, the string
1675 * 'Unknown:0xTTTT' will be returned where 'TTTT' is the hexadecimal
1676 * representation of the tag.
1678 public static function getName($type, $tag)
1684 case PelIfd::INTEROPERABILITY:
1685 return self::getValue(self::$exifTagsShort, $tag);
1687 return self::getValue(self::$gpsTagsShort, $tag);
1690 return self::unknownTag($tag);
1694 * Returns a title for an Exif tag.
1697 * the IFD type of the tag, one of {@link PelIfd::IFD0},
1698 * {@link PelIfd::IFD1}, {@link PelIfd::EXIF}, {@link PelIfd::GPS},
1699 * or {@link PelIfd::INTEROPERABILITY}.
1701 * @param PelTag $tag
1704 * @return string the title of the tag, e.g., 'Image Width' for the
1705 * {@link IMAGE_WIDTH} tag. If the tag isn't known, the string
1706 * 'Unknown Tag: 0xTT' will be returned where 'TT' is the
1707 * hexadecimal representation of the tag.
1709 public function getTitle($type, $tag)
1715 case PelIfd::INTEROPERABILITY:
1716 return Pel::tra(self::getValue(self::$exifTagsTitle, $tag));
1718 return Pel::tra(self::getValue(self::$gpsTagsShort, $tag));
1721 return self::unknownTag($tag);