Index: trunk/phase3/includes/Exif.php |
— | — | @@ -39,14 +39,14 @@ |
40 | 40 | /**#@+ |
41 | 41 | * Exif tag type definition |
42 | 42 | */ |
43 | | - const MW_EXIF_BYTE = 1; # An 8-bit (1-byte) unsigned integer. |
44 | | - const MW_EXIF_ASCII = 2; # An 8-bit byte containing one 7-bit ASCII code. The final byte is terminated with NULL. |
45 | | - const MW_EXIF_SHORT = 3; # A 16-bit (2-byte) unsigned integer. |
46 | | - const MW_EXIF_LONG = 4; # A 32-bit (4-byte) unsigned integer. |
47 | | - const MW_EXIF_RATIONAL = 5; # Two LONGs. The first LONG is the numerator and the second LONG expresses the denominator |
48 | | - const MW_EXIF_UNDEFINED = 7; # An 8-bit byte that can take any value depending on the field definition |
49 | | - const MW_EXIF_SLONG = 9; # A 32-bit (4-byte) signed integer (2's complement notation), |
50 | | - const MW_EXIF_SRATIONAL = 10; # Two SLONGs. The first SLONG is the numerator and the second SLONG is the denominator. |
| 43 | + const BYTE = 1; # An 8-bit (1-byte) unsigned integer. |
| 44 | + const ASCII = 2; # An 8-bit byte containing one 7-bit ASCII code. The final byte is terminated with NULL. |
| 45 | + const SHORT = 3; # A 16-bit (2-byte) unsigned integer. |
| 46 | + const LONG = 4; # A 32-bit (4-byte) unsigned integer. |
| 47 | + const RATIONAL = 5; # Two LONGs. The first LONG is the numerator and the second LONG expresses the denominator |
| 48 | + const UNDEFINED = 7; # An 8-bit byte that can take any value depending on the field definition |
| 49 | + const SLONG = 9; # A 32-bit (4-byte) signed integer (2's complement notation), |
| 50 | + const SRATIONAL = 10; # Two SLONGs. The first SLONG is the numerator and the second SLONG is the denominator. |
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Exif tags grouped by category, the tagname itself is the key and the type |
— | — | @@ -117,50 +117,50 @@ |
118 | 118 | 'tiff' => array( |
119 | 119 | # Tags relating to image structure |
120 | 120 | 'structure' => array( |
121 | | - 'ImageWidth' => Exif::MW_EXIF_SHORT.','.Exif::MW_EXIF_LONG, # Image width |
122 | | - 'ImageLength' => Exif::MW_EXIF_SHORT.','.Exif::MW_EXIF_LONG, # Image height |
123 | | - 'BitsPerSample' => Exif::MW_EXIF_SHORT, # Number of bits per component |
| 121 | + 'ImageWidth' => Exif::SHORT.','.Exif::LONG, # Image width |
| 122 | + 'ImageLength' => Exif::SHORT.','.Exif::LONG, # Image height |
| 123 | + 'BitsPerSample' => Exif::SHORT, # Number of bits per component |
124 | 124 | # "When a primary image is JPEG compressed, this designation is not" |
125 | 125 | # "necessary and is omitted." (p23) |
126 | | - 'Compression' => Exif::MW_EXIF_SHORT, # Compression scheme #p23 |
127 | | - 'PhotometricInterpretation' => Exif::MW_EXIF_SHORT, # Pixel composition #p23 |
128 | | - 'Orientation' => Exif::MW_EXIF_SHORT, # Orientation of image #p24 |
129 | | - 'SamplesPerPixel' => Exif::MW_EXIF_SHORT, # Number of components |
130 | | - 'PlanarConfiguration' => Exif::MW_EXIF_SHORT, # Image data arrangement #p24 |
131 | | - 'YCbCrSubSampling' => Exif::MW_EXIF_SHORT, # Subsampling ratio of Y to C #p24 |
132 | | - 'YCbCrPositioning' => Exif::MW_EXIF_SHORT, # Y and C positioning #p24-25 |
133 | | - 'XResolution' => Exif::MW_EXIF_RATIONAL, # Image resolution in width direction |
134 | | - 'YResolution' => Exif::MW_EXIF_RATIONAL, # Image resolution in height direction |
135 | | - 'ResolutionUnit' => Exif::MW_EXIF_SHORT, # Unit of X and Y resolution #(p26) |
| 126 | + 'Compression' => Exif::SHORT, # Compression scheme #p23 |
| 127 | + 'PhotometricInterpretation' => Exif::SHORT, # Pixel composition #p23 |
| 128 | + 'Orientation' => Exif::SHORT, # Orientation of image #p24 |
| 129 | + 'SamplesPerPixel' => Exif::SHORT, # Number of components |
| 130 | + 'PlanarConfiguration' => Exif::SHORT, # Image data arrangement #p24 |
| 131 | + 'YCbCrSubSampling' => Exif::SHORT, # Subsampling ratio of Y to C #p24 |
| 132 | + 'YCbCrPositioning' => Exif::SHORT, # Y and C positioning #p24-25 |
| 133 | + 'XResolution' => Exif::RATIONAL, # Image resolution in width direction |
| 134 | + 'YResolution' => Exif::RATIONAL, # Image resolution in height direction |
| 135 | + 'ResolutionUnit' => Exif::SHORT, # Unit of X and Y resolution #(p26) |
136 | 136 | ), |
137 | 137 | |
138 | 138 | # Tags relating to recording offset |
139 | 139 | 'offset' => array( |
140 | | - 'StripOffsets' => Exif::MW_EXIF_SHORT.','.Exif::MW_EXIF_LONG, # Image data location |
141 | | - 'RowsPerStrip' => Exif::MW_EXIF_SHORT.','.Exif::MW_EXIF_LONG, # Number of rows per strip |
142 | | - 'StripByteCounts' => Exif::MW_EXIF_SHORT.','.Exif::MW_EXIF_LONG, # Bytes per compressed strip |
143 | | - 'JPEGInterchangeFormat' => Exif::MW_EXIF_SHORT.','.Exif::MW_EXIF_LONG, # Offset to JPEG SOI |
144 | | - 'JPEGInterchangeFormatLength' => Exif::MW_EXIF_SHORT.','.Exif::MW_EXIF_LONG, # Bytes of JPEG data |
| 140 | + 'StripOffsets' => Exif::SHORT.','.Exif::LONG, # Image data location |
| 141 | + 'RowsPerStrip' => Exif::SHORT.','.Exif::LONG, # Number of rows per strip |
| 142 | + 'StripByteCounts' => Exif::SHORT.','.Exif::LONG, # Bytes per compressed strip |
| 143 | + 'JPEGInterchangeFormat' => Exif::SHORT.','.Exif::LONG, # Offset to JPEG SOI |
| 144 | + 'JPEGInterchangeFormatLength' => Exif::SHORT.','.Exif::LONG, # Bytes of JPEG data |
145 | 145 | ), |
146 | 146 | |
147 | 147 | # Tags relating to image data characteristics |
148 | 148 | 'characteristics' => array( |
149 | | - 'TransferFunction' => Exif::MW_EXIF_SHORT, # Transfer function |
150 | | - 'WhitePoint' => Exif::MW_EXIF_RATIONAL, # White point chromaticity |
151 | | - 'PrimaryChromaticities' => Exif::MW_EXIF_RATIONAL, # Chromaticities of primarities |
152 | | - 'YCbCrCoefficients' => Exif::MW_EXIF_RATIONAL, # Color space transformation matrix coefficients #p27 |
153 | | - 'ReferenceBlackWhite' => Exif::MW_EXIF_RATIONAL # Pair of black and white reference values |
| 149 | + 'TransferFunction' => Exif::SHORT, # Transfer function |
| 150 | + 'WhitePoint' => Exif::RATIONAL, # White point chromaticity |
| 151 | + 'PrimaryChromaticities' => Exif::RATIONAL, # Chromaticities of primarities |
| 152 | + 'YCbCrCoefficients' => Exif::RATIONAL, # Color space transformation matrix coefficients #p27 |
| 153 | + 'ReferenceBlackWhite' => Exif::RATIONAL # Pair of black and white reference values |
154 | 154 | ), |
155 | 155 | |
156 | 156 | # Other tags |
157 | 157 | 'other' => array( |
158 | | - 'DateTime' => Exif::MW_EXIF_ASCII, # File change date and time |
159 | | - 'ImageDescription' => Exif::MW_EXIF_ASCII, # Image title |
160 | | - 'Make' => Exif::MW_EXIF_ASCII, # Image input equipment manufacturer |
161 | | - 'Model' => Exif::MW_EXIF_ASCII, # Image input equipment model |
162 | | - 'Software' => Exif::MW_EXIF_ASCII, # Software used |
163 | | - 'Artist' => Exif::MW_EXIF_ASCII, # Person who created the image |
164 | | - 'Copyright' => Exif::MW_EXIF_ASCII, # Copyright holder |
| 158 | + 'DateTime' => Exif::ASCII, # File change date and time |
| 159 | + 'ImageDescription' => Exif::ASCII, # Image title |
| 160 | + 'Make' => Exif::ASCII, # Image input equipment manufacturer |
| 161 | + 'Model' => Exif::ASCII, # Image input equipment model |
| 162 | + 'Software' => Exif::ASCII, # Software used |
| 163 | + 'Artist' => Exif::ASCII, # Person who created the image |
| 164 | + 'Copyright' => Exif::ASCII, # Copyright holder |
165 | 165 | ), |
166 | 166 | ), |
167 | 167 | |
— | — | @@ -170,125 +170,125 @@ |
171 | 171 | 'version' => array( |
172 | 172 | # TODO: NOTE: Nonexistence of this field is taken to mean nonconformance |
173 | 173 | # to the EXIF 2.1 AND 2.2 standards |
174 | | - 'ExifVersion' => Exif::MW_EXIF_UNDEFINED, # Exif version |
175 | | - 'FlashpixVersion' => Exif::MW_EXIF_UNDEFINED, # Supported Flashpix version #p32 |
| 174 | + 'ExifVersion' => Exif::UNDEFINED, # Exif version |
| 175 | + 'FlashpixVersion' => Exif::UNDEFINED, # Supported Flashpix version #p32 |
176 | 176 | ), |
177 | 177 | |
178 | 178 | # Tags relating to Image Data Characteristics |
179 | 179 | 'characteristics' => array( |
180 | | - 'ColorSpace' => Exif::MW_EXIF_SHORT, # Color space information #p32 |
| 180 | + 'ColorSpace' => Exif::SHORT, # Color space information #p32 |
181 | 181 | ), |
182 | 182 | |
183 | 183 | # Tags relating to image configuration |
184 | 184 | 'configuration' => array( |
185 | | - 'ComponentsConfiguration' => Exif::MW_EXIF_UNDEFINED, # Meaning of each component #p33 |
186 | | - 'CompressedBitsPerPixel' => Exif::MW_EXIF_RATIONAL, # Image compression mode |
187 | | - 'PixelYDimension' => Exif::MW_EXIF_SHORT.','.Exif::MW_EXIF_LONG, # Valid image width |
188 | | - 'PixelXDimension' => Exif::MW_EXIF_SHORT.','.Exif::MW_EXIF_LONG, # Valind image height |
| 185 | + 'ComponentsConfiguration' => Exif::UNDEFINED, # Meaning of each component #p33 |
| 186 | + 'CompressedBitsPerPixel' => Exif::RATIONAL, # Image compression mode |
| 187 | + 'PixelYDimension' => Exif::SHORT.','.Exif::LONG, # Valid image width |
| 188 | + 'PixelXDimension' => Exif::SHORT.','.Exif::LONG, # Valind image height |
189 | 189 | ), |
190 | 190 | |
191 | 191 | # Tags relating to related user information |
192 | 192 | 'user' => array( |
193 | | - 'MakerNote' => Exif::MW_EXIF_UNDEFINED, # Manufacturer notes |
194 | | - 'UserComment' => Exif::MW_EXIF_UNDEFINED, # User comments #p34 |
| 193 | + 'MakerNote' => Exif::UNDEFINED, # Manufacturer notes |
| 194 | + 'UserComment' => Exif::UNDEFINED, # User comments #p34 |
195 | 195 | ), |
196 | 196 | |
197 | 197 | # Tags relating to related file information |
198 | 198 | 'related' => array( |
199 | | - 'RelatedSoundFile' => Exif::MW_EXIF_ASCII, # Related audio file |
| 199 | + 'RelatedSoundFile' => Exif::ASCII, # Related audio file |
200 | 200 | ), |
201 | 201 | |
202 | 202 | # Tags relating to date and time |
203 | 203 | 'dateandtime' => array( |
204 | | - 'DateTimeOriginal' => Exif::MW_EXIF_ASCII, # Date and time of original data generation #p36 |
205 | | - 'DateTimeDigitized' => Exif::MW_EXIF_ASCII, # Date and time of original data generation |
206 | | - 'SubSecTime' => Exif::MW_EXIF_ASCII, # DateTime subseconds |
207 | | - 'SubSecTimeOriginal' => Exif::MW_EXIF_ASCII, # DateTimeOriginal subseconds |
208 | | - 'SubSecTimeDigitized' => Exif::MW_EXIF_ASCII, # DateTimeDigitized subseconds |
| 204 | + 'DateTimeOriginal' => Exif::ASCII, # Date and time of original data generation #p36 |
| 205 | + 'DateTimeDigitized' => Exif::ASCII, # Date and time of original data generation |
| 206 | + 'SubSecTime' => Exif::ASCII, # DateTime subseconds |
| 207 | + 'SubSecTimeOriginal' => Exif::ASCII, # DateTimeOriginal subseconds |
| 208 | + 'SubSecTimeDigitized' => Exif::ASCII, # DateTimeDigitized subseconds |
209 | 209 | ), |
210 | 210 | |
211 | 211 | # Tags relating to picture-taking conditions (p31) |
212 | 212 | 'conditions' => array( |
213 | | - 'ExposureTime' => Exif::MW_EXIF_RATIONAL, # Exposure time |
214 | | - 'FNumber' => Exif::MW_EXIF_RATIONAL, # F Number |
215 | | - 'ExposureProgram' => Exif::MW_EXIF_SHORT, # Exposure Program #p38 |
216 | | - 'SpectralSensitivity' => Exif::MW_EXIF_ASCII, # Spectral sensitivity |
217 | | - 'ISOSpeedRatings' => Exif::MW_EXIF_SHORT, # ISO speed rating |
218 | | - 'OECF' => Exif::MW_EXIF_UNDEFINED, # Optoelectronic conversion factor |
219 | | - 'ShutterSpeedValue' => Exif::MW_EXIF_SRATIONAL, # Shutter speed |
220 | | - 'ApertureValue' => Exif::MW_EXIF_RATIONAL, # Aperture |
221 | | - 'BrightnessValue' => Exif::MW_EXIF_SRATIONAL, # Brightness |
222 | | - 'ExposureBiasValue' => Exif::MW_EXIF_SRATIONAL, # Exposure bias |
223 | | - 'MaxApertureValue' => Exif::MW_EXIF_RATIONAL, # Maximum land aperture |
224 | | - 'SubjectDistance' => Exif::MW_EXIF_RATIONAL, # Subject distance |
225 | | - 'MeteringMode' => Exif::MW_EXIF_SHORT, # Metering mode #p40 |
226 | | - 'LightSource' => Exif::MW_EXIF_SHORT, # Light source #p40-41 |
227 | | - 'Flash' => Exif::MW_EXIF_SHORT, # Flash #p41-42 |
228 | | - 'FocalLength' => Exif::MW_EXIF_RATIONAL, # Lens focal length |
229 | | - 'SubjectArea' => Exif::MW_EXIF_SHORT, # Subject area |
230 | | - 'FlashEnergy' => Exif::MW_EXIF_RATIONAL, # Flash energy |
231 | | - 'SpatialFrequencyResponse' => Exif::MW_EXIF_UNDEFINED, # Spatial frequency response |
232 | | - 'FocalPlaneXResolution' => Exif::MW_EXIF_RATIONAL, # Focal plane X resolution |
233 | | - 'FocalPlaneYResolution' => Exif::MW_EXIF_RATIONAL, # Focal plane Y resolution |
234 | | - 'FocalPlaneResolutionUnit' => Exif::MW_EXIF_SHORT, # Focal plane resolution unit #p46 |
235 | | - 'SubjectLocation' => Exif::MW_EXIF_SHORT, # Subject location |
236 | | - 'ExposureIndex' => Exif::MW_EXIF_RATIONAL, # Exposure index |
237 | | - 'SensingMethod' => Exif::MW_EXIF_SHORT, # Sensing method #p46 |
238 | | - 'FileSource' => Exif::MW_EXIF_UNDEFINED, # File source #p47 |
239 | | - 'SceneType' => Exif::MW_EXIF_UNDEFINED, # Scene type #p47 |
240 | | - 'CFAPattern' => Exif::MW_EXIF_UNDEFINED, # CFA pattern |
241 | | - 'CustomRendered' => Exif::MW_EXIF_SHORT, # Custom image processing #p48 |
242 | | - 'ExposureMode' => Exif::MW_EXIF_SHORT, # Exposure mode #p48 |
243 | | - 'WhiteBalance' => Exif::MW_EXIF_SHORT, # White Balance #p49 |
244 | | - 'DigitalZoomRatio' => Exif::MW_EXIF_RATIONAL, # Digital zoom ration |
245 | | - 'FocalLengthIn35mmFilm' => Exif::MW_EXIF_SHORT, # Focal length in 35 mm film |
246 | | - 'SceneCaptureType' => Exif::MW_EXIF_SHORT, # Scene capture type #p49 |
247 | | - 'GainControl' => Exif::MW_EXIF_RATIONAL, # Scene control #p49-50 |
248 | | - 'Contrast' => Exif::MW_EXIF_SHORT, # Contrast #p50 |
249 | | - 'Saturation' => Exif::MW_EXIF_SHORT, # Saturation #p50 |
250 | | - 'Sharpness' => Exif::MW_EXIF_SHORT, # Sharpness #p50 |
251 | | - 'DeviceSettingDescription' => Exif::MW_EXIF_UNDEFINED, # Desice settings description |
252 | | - 'SubjectDistanceRange' => Exif::MW_EXIF_SHORT, # Subject distance range #p51 |
| 213 | + 'ExposureTime' => Exif::RATIONAL, # Exposure time |
| 214 | + 'FNumber' => Exif::RATIONAL, # F Number |
| 215 | + 'ExposureProgram' => Exif::SHORT, # Exposure Program #p38 |
| 216 | + 'SpectralSensitivity' => Exif::ASCII, # Spectral sensitivity |
| 217 | + 'ISOSpeedRatings' => Exif::SHORT, # ISO speed rating |
| 218 | + 'OECF' => Exif::UNDEFINED, # Optoelectronic conversion factor |
| 219 | + 'ShutterSpeedValue' => Exif::SRATIONAL, # Shutter speed |
| 220 | + 'ApertureValue' => Exif::RATIONAL, # Aperture |
| 221 | + 'BrightnessValue' => Exif::SRATIONAL, # Brightness |
| 222 | + 'ExposureBiasValue' => Exif::SRATIONAL, # Exposure bias |
| 223 | + 'MaxApertureValue' => Exif::RATIONAL, # Maximum land aperture |
| 224 | + 'SubjectDistance' => Exif::RATIONAL, # Subject distance |
| 225 | + 'MeteringMode' => Exif::SHORT, # Metering mode #p40 |
| 226 | + 'LightSource' => Exif::SHORT, # Light source #p40-41 |
| 227 | + 'Flash' => Exif::SHORT, # Flash #p41-42 |
| 228 | + 'FocalLength' => Exif::RATIONAL, # Lens focal length |
| 229 | + 'SubjectArea' => Exif::SHORT, # Subject area |
| 230 | + 'FlashEnergy' => Exif::RATIONAL, # Flash energy |
| 231 | + 'SpatialFrequencyResponse' => Exif::UNDEFINED, # Spatial frequency response |
| 232 | + 'FocalPlaneXResolution' => Exif::RATIONAL, # Focal plane X resolution |
| 233 | + 'FocalPlaneYResolution' => Exif::RATIONAL, # Focal plane Y resolution |
| 234 | + 'FocalPlaneResolutionUnit' => Exif::SHORT, # Focal plane resolution unit #p46 |
| 235 | + 'SubjectLocation' => Exif::SHORT, # Subject location |
| 236 | + 'ExposureIndex' => Exif::RATIONAL, # Exposure index |
| 237 | + 'SensingMethod' => Exif::SHORT, # Sensing method #p46 |
| 238 | + 'FileSource' => Exif::UNDEFINED, # File source #p47 |
| 239 | + 'SceneType' => Exif::UNDEFINED, # Scene type #p47 |
| 240 | + 'CFAPattern' => Exif::UNDEFINED, # CFA pattern |
| 241 | + 'CustomRendered' => Exif::SHORT, # Custom image processing #p48 |
| 242 | + 'ExposureMode' => Exif::SHORT, # Exposure mode #p48 |
| 243 | + 'WhiteBalance' => Exif::SHORT, # White Balance #p49 |
| 244 | + 'DigitalZoomRatio' => Exif::RATIONAL, # Digital zoom ration |
| 245 | + 'FocalLengthIn35mmFilm' => Exif::SHORT, # Focal length in 35 mm film |
| 246 | + 'SceneCaptureType' => Exif::SHORT, # Scene capture type #p49 |
| 247 | + 'GainControl' => Exif::RATIONAL, # Scene control #p49-50 |
| 248 | + 'Contrast' => Exif::SHORT, # Contrast #p50 |
| 249 | + 'Saturation' => Exif::SHORT, # Saturation #p50 |
| 250 | + 'Sharpness' => Exif::SHORT, # Sharpness #p50 |
| 251 | + 'DeviceSettingDescription' => Exif::UNDEFINED, # Desice settings description |
| 252 | + 'SubjectDistanceRange' => Exif::SHORT, # Subject distance range #p51 |
253 | 253 | ), |
254 | 254 | |
255 | 255 | 'other' => array( |
256 | | - 'ImageUniqueID' => Exif::MW_EXIF_ASCII, # Unique image ID |
| 256 | + 'ImageUniqueID' => Exif::ASCII, # Unique image ID |
257 | 257 | ), |
258 | 258 | ), |
259 | 259 | |
260 | 260 | # GPS Attribute Information (p52) |
261 | 261 | 'gps' => array( |
262 | | - 'GPSVersionID' => Exif::MW_EXIF_BYTE, # GPS tag version |
263 | | - 'GPSLatitudeRef' => Exif::MW_EXIF_ASCII, # North or South Latitude #p52-53 |
264 | | - 'GPSLatitude' => Exif::MW_EXIF_RATIONAL, # Latitude |
265 | | - 'GPSLongitudeRef' => Exif::MW_EXIF_ASCII, # East or West Longitude #p53 |
266 | | - 'GPSLongitude' => Exif::MW_EXIF_RATIONAL, # Longitude |
267 | | - 'GPSAltitudeRef' => Exif::MW_EXIF_BYTE, # Altitude reference |
268 | | - 'GPSAltitude' => Exif::MW_EXIF_RATIONAL, # Altitude |
269 | | - 'GPSTimeStamp' => Exif::MW_EXIF_RATIONAL, # GPS time (atomic clock) |
270 | | - 'GPSSatellites' => Exif::MW_EXIF_ASCII, # Satellites used for measurement |
271 | | - 'GPSStatus' => Exif::MW_EXIF_ASCII, # Receiver status #p54 |
272 | | - 'GPSMeasureMode' => Exif::MW_EXIF_ASCII, # Measurement mode #p54-55 |
273 | | - 'GPSDOP' => Exif::MW_EXIF_RATIONAL, # Measurement precision |
274 | | - 'GPSSpeedRef' => Exif::MW_EXIF_ASCII, # Speed unit #p55 |
275 | | - 'GPSSpeed' => Exif::MW_EXIF_RATIONAL, # Speed of GPS receiver |
276 | | - 'GPSTrackRef' => Exif::MW_EXIF_ASCII, # Reference for direction of movement #p55 |
277 | | - 'GPSTrack' => Exif::MW_EXIF_RATIONAL, # Direction of movement |
278 | | - 'GPSImgDirectionRef' => Exif::MW_EXIF_ASCII, # Reference for direction of image #p56 |
279 | | - 'GPSImgDirection' => Exif::MW_EXIF_RATIONAL, # Direction of image |
280 | | - 'GPSMapDatum' => Exif::MW_EXIF_ASCII, # Geodetic survey data used |
281 | | - 'GPSDestLatitudeRef' => Exif::MW_EXIF_ASCII, # Reference for latitude of destination #p56 |
282 | | - 'GPSDestLatitude' => Exif::MW_EXIF_RATIONAL, # Latitude destination |
283 | | - 'GPSDestLongitudeRef' => Exif::MW_EXIF_ASCII, # Reference for longitude of destination #p57 |
284 | | - 'GPSDestLongitude' => Exif::MW_EXIF_RATIONAL, # Longitude of destination |
285 | | - 'GPSDestBearingRef' => Exif::MW_EXIF_ASCII, # Reference for bearing of destination #p57 |
286 | | - 'GPSDestBearing' => Exif::MW_EXIF_RATIONAL, # Bearing of destination |
287 | | - 'GPSDestDistanceRef' => Exif::MW_EXIF_ASCII, # Reference for distance to destination #p57-58 |
288 | | - 'GPSDestDistance' => Exif::MW_EXIF_RATIONAL, # Distance to destination |
289 | | - 'GPSProcessingMethod' => Exif::MW_EXIF_UNDEFINED, # Name of GPS processing method |
290 | | - 'GPSAreaInformation' => Exif::MW_EXIF_UNDEFINED, # Name of GPS area |
291 | | - 'GPSDateStamp' => Exif::MW_EXIF_ASCII, # GPS date |
292 | | - 'GPSDifferential' => Exif::MW_EXIF_SHORT, # GPS differential correction |
| 262 | + 'GPSVersionID' => Exif::BYTE, # GPS tag version |
| 263 | + 'GPSLatitudeRef' => Exif::ASCII, # North or South Latitude #p52-53 |
| 264 | + 'GPSLatitude' => Exif::RATIONAL, # Latitude |
| 265 | + 'GPSLongitudeRef' => Exif::ASCII, # East or West Longitude #p53 |
| 266 | + 'GPSLongitude' => Exif::RATIONAL, # Longitude |
| 267 | + 'GPSAltitudeRef' => Exif::BYTE, # Altitude reference |
| 268 | + 'GPSAltitude' => Exif::RATIONAL, # Altitude |
| 269 | + 'GPSTimeStamp' => Exif::RATIONAL, # GPS time (atomic clock) |
| 270 | + 'GPSSatellites' => Exif::ASCII, # Satellites used for measurement |
| 271 | + 'GPSStatus' => Exif::ASCII, # Receiver status #p54 |
| 272 | + 'GPSMeasureMode' => Exif::ASCII, # Measurement mode #p54-55 |
| 273 | + 'GPSDOP' => Exif::RATIONAL, # Measurement precision |
| 274 | + 'GPSSpeedRef' => Exif::ASCII, # Speed unit #p55 |
| 275 | + 'GPSSpeed' => Exif::RATIONAL, # Speed of GPS receiver |
| 276 | + 'GPSTrackRef' => Exif::ASCII, # Reference for direction of movement #p55 |
| 277 | + 'GPSTrack' => Exif::RATIONAL, # Direction of movement |
| 278 | + 'GPSImgDirectionRef' => Exif::ASCII, # Reference for direction of image #p56 |
| 279 | + 'GPSImgDirection' => Exif::RATIONAL, # Direction of image |
| 280 | + 'GPSMapDatum' => Exif::ASCII, # Geodetic survey data used |
| 281 | + 'GPSDestLatitudeRef' => Exif::ASCII, # Reference for latitude of destination #p56 |
| 282 | + 'GPSDestLatitude' => Exif::RATIONAL, # Latitude destination |
| 283 | + 'GPSDestLongitudeRef' => Exif::ASCII, # Reference for longitude of destination #p57 |
| 284 | + 'GPSDestLongitude' => Exif::RATIONAL, # Longitude of destination |
| 285 | + 'GPSDestBearingRef' => Exif::ASCII, # Reference for bearing of destination #p57 |
| 286 | + 'GPSDestBearing' => Exif::RATIONAL, # Bearing of destination |
| 287 | + 'GPSDestDistanceRef' => Exif::ASCII, # Reference for distance to destination #p57-58 |
| 288 | + 'GPSDestDistance' => Exif::RATIONAL, # Distance to destination |
| 289 | + 'GPSProcessingMethod' => Exif::UNDEFINED, # Name of GPS processing method |
| 290 | + 'GPSAreaInformation' => Exif::UNDEFINED, # Name of GPS area |
| 291 | + 'GPSDateStamp' => Exif::ASCII, # GPS date |
| 292 | + 'GPSDifferential' => Exif::SHORT, # GPS differential correction |
293 | 293 | ), |
294 | 294 | ); |
295 | 295 | |
— | — | @@ -420,7 +420,7 @@ |
421 | 421 | * @return bool |
422 | 422 | */ |
423 | 423 | function isByte( $in ) { |
424 | | - if ( sprintf('%d', $in) == $in && $in >= 0 && $in <= 255 ) { |
| 424 | + if ( !is_array( $in ) && sprintf('%d', $in) == $in && $in >= 0 && $in <= 255 ) { |
425 | 425 | $this->debug( $in, __FUNCTION__, true ); |
426 | 426 | return true; |
427 | 427 | } else { |
— | — | @@ -430,6 +430,10 @@ |
431 | 431 | } |
432 | 432 | |
433 | 433 | function isASCII( $in ) { |
| 434 | + if ( is_array( $in ) ) { |
| 435 | + return false; |
| 436 | + } |
| 437 | + |
434 | 438 | if ( preg_match( "/[^\x0a\x20-\x7e]/", $in ) ) { |
435 | 439 | $this->debug( $in, __FUNCTION__, 'found a character not in our whitelist' ); |
436 | 440 | return false; |
— | — | @@ -444,7 +448,7 @@ |
445 | 449 | } |
446 | 450 | |
447 | 451 | function isShort( $in ) { |
448 | | - if ( sprintf('%d', $in) == $in && $in >= 0 && $in <= 65536 ) { |
| 452 | + if ( !is_array( $in ) && sprintf('%d', $in) == $in && $in >= 0 && $in <= 65536 ) { |
449 | 453 | $this->debug( $in, __FUNCTION__, true ); |
450 | 454 | return true; |
451 | 455 | } else { |
— | — | @@ -454,7 +458,7 @@ |
455 | 459 | } |
456 | 460 | |
457 | 461 | function isLong( $in ) { |
458 | | - if ( sprintf('%d', $in) == $in && $in >= 0 && $in <= 4294967296 ) { |
| 462 | + if ( !is_array( $in ) && sprintf('%d', $in) == $in && $in >= 0 && $in <= 4294967296 ) { |
459 | 463 | $this->debug( $in, __FUNCTION__, true ); |
460 | 464 | return true; |
461 | 465 | } else { |
— | — | @@ -464,7 +468,7 @@ |
465 | 469 | } |
466 | 470 | |
467 | 471 | function isRational( $in ) { |
468 | | - if ( @preg_match( "/^(\d+)\/(\d+[1-9]|[1-9]\d*)$/", $in, $m ) ) { # Avoid division by zero |
| 472 | + if ( !is_array( $in ) && @preg_match( "/^(\d+)\/(\d+[1-9]|[1-9]\d*)$/", $in, $m ) ) { # Avoid division by zero |
469 | 473 | return $this->isLong( $m[1] ) && $this->isLong( $m[2] ); |
470 | 474 | } else { |
471 | 475 | $this->debug( $in, __FUNCTION__, 'fed a non-fraction value' ); |
— | — | @@ -473,7 +477,7 @@ |
474 | 478 | } |
475 | 479 | |
476 | 480 | function isUndefined( $in ) { |
477 | | - if ( preg_match( "/^\d{4}$/", $in ) ) { // Allow ExifVersion and FlashpixVersion |
| 481 | + if ( !is_array( $in ) && preg_match( "/^\d{4}$/", $in ) ) { // Allow ExifVersion and FlashpixVersion |
478 | 482 | $this->debug( $in, __FUNCTION__, true ); |
479 | 483 | return true; |
480 | 484 | } else { |
— | — | @@ -493,7 +497,7 @@ |
494 | 498 | } |
495 | 499 | |
496 | 500 | function isSrational( $in ) { |
497 | | - if ( preg_match( "/^(\d+)\/(\d+[1-9]|[1-9]\d*)$/", $in, $m ) ) { # Avoid division by zero |
| 501 | + if ( !is_array( $in ) && preg_match( "/^(\d+)\/(\d+[1-9]|[1-9]\d*)$/", $in, $m ) ) { # Avoid division by zero |
498 | 502 | return $this->isSlong( $m[0] ) && $this->isSlong( $m[1] ); |
499 | 503 | } else { |
500 | 504 | $this->debug( $in, __FUNCTION__, 'fed a non-fraction value' ); |
— | — | @@ -513,33 +517,33 @@ |
514 | 518 | */ |
515 | 519 | function validate( $tag, $val ) { |
516 | 520 | $debug = "tag is '$tag'"; |
517 | | - // Fucks up if not typecast |
| 521 | + // Does not work if not typecast |
518 | 522 | switch( (string)$this->mFlatExifTags[$tag] ) { |
519 | | - case (string)Exif::MW_EXIF_BYTE: |
| 523 | + case (string)Exif::BYTE: |
520 | 524 | $this->debug( $val, __FUNCTION__, $debug ); |
521 | 525 | return $this->isByte( $val ); |
522 | | - case (string)Exif::MW_EXIF_ASCII: |
| 526 | + case (string)Exif::ASCII: |
523 | 527 | $this->debug( $val, __FUNCTION__, $debug ); |
524 | 528 | return $this->isASCII( $val ); |
525 | | - case (string)Exif::MW_EXIF_SHORT: |
| 529 | + case (string)Exif::SHORT: |
526 | 530 | $this->debug( $val, __FUNCTION__, $debug ); |
527 | 531 | return $this->isShort( $val ); |
528 | | - case (string)Exif::MW_EXIF_LONG: |
| 532 | + case (string)Exif::LONG: |
529 | 533 | $this->debug( $val, __FUNCTION__, $debug ); |
530 | 534 | return $this->isLong( $val ); |
531 | | - case (string)Exif::MW_EXIF_RATIONAL: |
| 535 | + case (string)Exif::RATIONAL: |
532 | 536 | $this->debug( $val, __FUNCTION__, $debug ); |
533 | 537 | return $this->isRational( $val ); |
534 | | - case (string)Exif::MW_EXIF_UNDEFINED: |
| 538 | + case (string)Exif::UNDEFINED: |
535 | 539 | $this->debug( $val, __FUNCTION__, $debug ); |
536 | 540 | return $this->isUndefined( $val ); |
537 | | - case (string)Exif::MW_EXIF_SLONG: |
| 541 | + case (string)Exif::SLONG: |
538 | 542 | $this->debug( $val, __FUNCTION__, $debug ); |
539 | 543 | return $this->isSlong( $val ); |
540 | | - case (string)Exif::MW_EXIF_SRATIONAL: |
| 544 | + case (string)Exif::SRATIONAL: |
541 | 545 | $this->debug( $val, __FUNCTION__, $debug ); |
542 | 546 | return $this->isSrational( $val ); |
543 | | - case (string)Exif::MW_EXIF_SHORT.','.Exif::MW_EXIF_LONG: |
| 547 | + case (string)Exif::SHORT.','.Exif::LONG: |
544 | 548 | $this->debug( $val, __FUNCTION__, $debug ); |
545 | 549 | return $this->isShort( $val ) || $this->isLong( $val ); |
546 | 550 | default: |
— | — | @@ -549,7 +553,7 @@ |
550 | 554 | } |
551 | 555 | |
552 | 556 | /** |
553 | | - * Conviniance function for debugging output |
| 557 | + * Convenience function for debugging output |
554 | 558 | * |
555 | 559 | * @private |
556 | 560 | * |
— | — | @@ -574,7 +578,7 @@ |
575 | 579 | } |
576 | 580 | |
577 | 581 | /** |
578 | | - * Conviniance function for debugging output |
| 582 | + * Convenience function for debugging output |
579 | 583 | * |
580 | 584 | * @private |
581 | 585 | * |
— | — | @@ -1023,7 +1027,7 @@ |
1024 | 1028 | } |
1025 | 1029 | |
1026 | 1030 | /** |
1027 | | - * Conviniance function for getFormattedData() |
| 1031 | + * Convenience function for getFormattedData() |
1028 | 1032 | * |
1029 | 1033 | * @private |
1030 | 1034 | * |
— | — | @@ -1104,4 +1108,17 @@ |
1105 | 1109 | return $a; |
1106 | 1110 | } |
1107 | 1111 | } |
| 1112 | + |
| 1113 | +/** |
| 1114 | + * MW 1.6 compatibility |
| 1115 | + */ |
| 1116 | +define( 'MW_EXIF_BYTE', Exif::BYTE ); |
| 1117 | +define( 'MW_EXIF_ASCII', Exif::ASCII ); |
| 1118 | +define( 'MW_EXIF_SHORT', Exif::SHORT ); |
| 1119 | +define( 'MW_EXIF_LONG', Exif::LONG ); |
| 1120 | +define( 'MW_EXIF_RATIONAL', Exif::RATIONAL ); |
| 1121 | +define( 'MW_EXIF_UNDEFINED', Exif::UNDEFINED ); |
| 1122 | +define( 'MW_EXIF_SLONG', Exif::SLONG ); |
| 1123 | +define( 'MW_EXIF_SRATIONAL', Exif::SRATIONAL ); |
| 1124 | + |
1108 | 1125 | ?> |