r14936 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r14935‎ | r14936 | r14937 >
Date:12:24, 23 June 2006
Author:tstarling
Status:old
Tags:
Comment:
* Let yes be yes and no be no
* Shortened Exif class constants
* Hopefully fixed preg_match warnings by checking is_array
Modified paths:
  • /trunk/phase3/includes/Exif.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Exif.php
@@ -39,14 +39,14 @@
4040 /**#@+
4141 * Exif tag type definition
4242 */
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.
5151
5252 /**
5353 * Exif tags grouped by category, the tagname itself is the key and the type
@@ -117,50 +117,50 @@
118118 'tiff' => array(
119119 # Tags relating to image structure
120120 '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
124124 # "When a primary image is JPEG compressed, this designation is not"
125125 # "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)
136136 ),
137137
138138 # Tags relating to recording offset
139139 '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
145145 ),
146146
147147 # Tags relating to image data characteristics
148148 '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
154154 ),
155155
156156 # Other tags
157157 '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
165165 ),
166166 ),
167167
@@ -170,125 +170,125 @@
171171 'version' => array(
172172 # TODO: NOTE: Nonexistence of this field is taken to mean nonconformance
173173 # 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
176176 ),
177177
178178 # Tags relating to Image Data Characteristics
179179 'characteristics' => array(
180 - 'ColorSpace' => Exif::MW_EXIF_SHORT, # Color space information #p32
 180+ 'ColorSpace' => Exif::SHORT, # Color space information #p32
181181 ),
182182
183183 # Tags relating to image configuration
184184 '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
189189 ),
190190
191191 # Tags relating to related user information
192192 '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
195195 ),
196196
197197 # Tags relating to related file information
198198 'related' => array(
199 - 'RelatedSoundFile' => Exif::MW_EXIF_ASCII, # Related audio file
 199+ 'RelatedSoundFile' => Exif::ASCII, # Related audio file
200200 ),
201201
202202 # Tags relating to date and time
203203 '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
209209 ),
210210
211211 # Tags relating to picture-taking conditions (p31)
212212 '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
253253 ),
254254
255255 'other' => array(
256 - 'ImageUniqueID' => Exif::MW_EXIF_ASCII, # Unique image ID
 256+ 'ImageUniqueID' => Exif::ASCII, # Unique image ID
257257 ),
258258 ),
259259
260260 # GPS Attribute Information (p52)
261261 '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
293293 ),
294294 );
295295
@@ -420,7 +420,7 @@
421421 * @return bool
422422 */
423423 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 ) {
425425 $this->debug( $in, __FUNCTION__, true );
426426 return true;
427427 } else {
@@ -430,6 +430,10 @@
431431 }
432432
433433 function isASCII( $in ) {
 434+ if ( is_array( $in ) ) {
 435+ return false;
 436+ }
 437+
434438 if ( preg_match( "/[^\x0a\x20-\x7e]/", $in ) ) {
435439 $this->debug( $in, __FUNCTION__, 'found a character not in our whitelist' );
436440 return false;
@@ -444,7 +448,7 @@
445449 }
446450
447451 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 ) {
449453 $this->debug( $in, __FUNCTION__, true );
450454 return true;
451455 } else {
@@ -454,7 +458,7 @@
455459 }
456460
457461 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 ) {
459463 $this->debug( $in, __FUNCTION__, true );
460464 return true;
461465 } else {
@@ -464,7 +468,7 @@
465469 }
466470
467471 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
469473 return $this->isLong( $m[1] ) && $this->isLong( $m[2] );
470474 } else {
471475 $this->debug( $in, __FUNCTION__, 'fed a non-fraction value' );
@@ -473,7 +477,7 @@
474478 }
475479
476480 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
478482 $this->debug( $in, __FUNCTION__, true );
479483 return true;
480484 } else {
@@ -493,7 +497,7 @@
494498 }
495499
496500 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
498502 return $this->isSlong( $m[0] ) && $this->isSlong( $m[1] );
499503 } else {
500504 $this->debug( $in, __FUNCTION__, 'fed a non-fraction value' );
@@ -513,33 +517,33 @@
514518 */
515519 function validate( $tag, $val ) {
516520 $debug = "tag is '$tag'";
517 - // Fucks up if not typecast
 521+ // Does not work if not typecast
518522 switch( (string)$this->mFlatExifTags[$tag] ) {
519 - case (string)Exif::MW_EXIF_BYTE:
 523+ case (string)Exif::BYTE:
520524 $this->debug( $val, __FUNCTION__, $debug );
521525 return $this->isByte( $val );
522 - case (string)Exif::MW_EXIF_ASCII:
 526+ case (string)Exif::ASCII:
523527 $this->debug( $val, __FUNCTION__, $debug );
524528 return $this->isASCII( $val );
525 - case (string)Exif::MW_EXIF_SHORT:
 529+ case (string)Exif::SHORT:
526530 $this->debug( $val, __FUNCTION__, $debug );
527531 return $this->isShort( $val );
528 - case (string)Exif::MW_EXIF_LONG:
 532+ case (string)Exif::LONG:
529533 $this->debug( $val, __FUNCTION__, $debug );
530534 return $this->isLong( $val );
531 - case (string)Exif::MW_EXIF_RATIONAL:
 535+ case (string)Exif::RATIONAL:
532536 $this->debug( $val, __FUNCTION__, $debug );
533537 return $this->isRational( $val );
534 - case (string)Exif::MW_EXIF_UNDEFINED:
 538+ case (string)Exif::UNDEFINED:
535539 $this->debug( $val, __FUNCTION__, $debug );
536540 return $this->isUndefined( $val );
537 - case (string)Exif::MW_EXIF_SLONG:
 541+ case (string)Exif::SLONG:
538542 $this->debug( $val, __FUNCTION__, $debug );
539543 return $this->isSlong( $val );
540 - case (string)Exif::MW_EXIF_SRATIONAL:
 544+ case (string)Exif::SRATIONAL:
541545 $this->debug( $val, __FUNCTION__, $debug );
542546 return $this->isSrational( $val );
543 - case (string)Exif::MW_EXIF_SHORT.','.Exif::MW_EXIF_LONG:
 547+ case (string)Exif::SHORT.','.Exif::LONG:
544548 $this->debug( $val, __FUNCTION__, $debug );
545549 return $this->isShort( $val ) || $this->isLong( $val );
546550 default:
@@ -549,7 +553,7 @@
550554 }
551555
552556 /**
553 - * Conviniance function for debugging output
 557+ * Convenience function for debugging output
554558 *
555559 * @private
556560 *
@@ -574,7 +578,7 @@
575579 }
576580
577581 /**
578 - * Conviniance function for debugging output
 582+ * Convenience function for debugging output
579583 *
580584 * @private
581585 *
@@ -1023,7 +1027,7 @@
10241028 }
10251029
10261030 /**
1027 - * Conviniance function for getFormattedData()
 1031+ * Convenience function for getFormattedData()
10281032 *
10291033 * @private
10301034 *
@@ -1104,4 +1108,17 @@
11051109 return $a;
11061110 }
11071111 }
 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+
11081125 ?>