r69273 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69272‎ | r69273 | r69274 >
Date:21:07, 11 July 2010
Author:bawolff
Status:ok
Tags:
Comment:
Follow up to r69216. Address comments.
Modified paths:
  • /branches/img_metadata/phase3/includes/Exif.php (modified) (history)
  • /branches/img_metadata/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: branches/img_metadata/phase3/includes/Exif.php
@@ -191,7 +191,8 @@
192192 'ExposureProgram' => Exif::SHORT, # Exposure Program #p38
193193 'SpectralSensitivity' => Exif::ASCII, # Spectral sensitivity
194194 'ISOSpeedRatings' => Exif::SHORT, # ISO speed rating
195 - 'OECF' => Exif::IGNORE, # Optoelectronic conversion factor. Note: We don't have support for this atm.
 195+ 'OECF' => Exif::IGNORE,
 196+ # Optoelectronic conversion factor. Note: We don't have support for this atm.
196197 'ShutterSpeedValue' => Exif::SRATIONAL, # Shutter speed
197198 'ApertureValue' => Exif::RATIONAL, # Aperture
198199 'BrightnessValue' => Exif::SRATIONAL, # Brightness
@@ -224,7 +225,9 @@
225226 'Contrast' => Exif::SHORT, # Contrast #p50
226227 'Saturation' => Exif::SHORT, # Saturation #p50
227228 'Sharpness' => Exif::SHORT, # Sharpness #p50
228 - 'DeviceSettingDescription' => Exif::IGNORE, # Desice settings description. FIXME: this could maybe be supported.
 229+ 'DeviceSettingDescription' => Exif::IGNORE,
 230+ # Desice settings description. This could maybe be supported. Need to find an
 231+ # example file that uses this to see if it has stuff of interest in it.
229232 'SubjectDistanceRange' => Exif::SHORT, # Subject distance range #p51
230233
231234 'ImageUniqueID' => Exif::ASCII, # Unique image ID
@@ -232,12 +235,16 @@
233236
234237 # GPS Attribute Information (p52)
235238 'GPS' => array(
236 - 'GPSVersion' => Exif::UNDEFINED, # array( Exif::BYTE, 4 ) GPS tag version. Note exif standard calls this GPSVersionID, but php doesn't like the id. also php thinks its wrong type
 239+ 'GPSVersion' => Exif::UNDEFINED,
 240+ # Should be an array of 4 Exif::BYTE's. However php treats it as an undefined
 241+ # Note exif standard calls this GPSVersionID, but php doesn't like the id suffix
237242 'GPSLatitudeRef' => Exif::ASCII, # North or South Latitude #p52-53
238243 'GPSLatitude' => array( Exif::RATIONAL, 3 ), # Latitude
239244 'GPSLongitudeRef' => Exif::ASCII, # East or West Longitude #p53
240245 'GPSLongitude' => array( Exif::RATIONAL, 3), # Longitude
241 - 'GPSAltitudeRef' => Exif::UNDEFINED, # Altitude reference. Note, the exif standard says this should be an EXIF::Byte, but php seems to disagree.
 246+ 'GPSAltitudeRef' => Exif::UNDEFINED,
 247+ # Altitude reference. Note, the exif standard says this should be an EXIF::Byte,
 248+ # but php seems to disagree.
242249 'GPSAltitude' => Exif::RATIONAL, # Altitude
243250 'GPSTimeStamp' => array( Exif::RATIONAL, 3), # GPS time (atomic clock)
244251 'GPSSatellites' => Exif::ASCII, # Satellites used for measurement
@@ -347,14 +354,15 @@
348355 unset( $this->mFilteredExifData['GPSAltitudeRef'] );
349356 }
350357
351 - $this->getOrd( 'FileSource' );
352 - $this->getOrd( 'SceneType' );
 358+ $this->exifPropToOrd( 'FileSource' );
 359+ $this->exifPropToOrd( 'SceneType' );
353360
354361 $this->charCodeString( 'UserComment' );
355362 $this->charCodeString( 'GPSProcessingMethod');
356363 $this->charCodeString( 'GPSAreaInformation' );
357364
358365 //ComponentsConfiguration should really be an array instead of a string...
 366+ //This turns a string of binary numbers into an array of numbers.
359367
360368 if ( isset ( $this->mFilteredExifData['ComponentsConfiguration'] ) ) {
361369 $val = $this->mFilteredExifData['ComponentsConfiguration'];
@@ -366,8 +374,13 @@
367375 $this->mFilteredExifData['ComponentsConfiguration'] = $ccVals;
368376 }
369377
370 - //GPSVersion(ID) is just very screwed up by php
371 - //put into a version string, and change the tag name.
 378+ //GPSVersion(ID) is treated as the wrong type by php exif support.
 379+ //Go through each byte turning it into a version string.
 380+ //For example: "\x00\x00\x02\x02" -> "2.2.0.0"
 381+
 382+ //Also change exif tag name from GPSVersion (what php exif thinks it is)
 383+ //to GPSVersionID (what the exif standard thinks it is).
 384+
372385 if ( isset ( $this->mFilteredExifData['GPSVersion'] ) ) {
373386 $val = $this->mFilteredExifData['GPSVersion'];
374387 $newVal = '';
@@ -433,7 +446,7 @@
434447 * the type of UNDEFINED field
435448 * @param $prop String name of property
436449 */
437 - private function getOrd ( $prop ) {
 450+ private function exifPropToOrd ( $prop ) {
438451 if ( isset( $this->mFilteredExifData[$prop] ) ) {
439452 $this->mFilteredExifData[$prop] = ord( $this->mFilteredExifData[$prop] );
440453 }
Index: branches/img_metadata/phase3/languages/messages/MessagesEn.php
@@ -3916,8 +3916,8 @@
39173917 'exif-gpslongitude-w' => 'West longitude',
39183918
39193919 # Pseudotags used for GPSAltitude
3920 -'exif-gpsaltitude-above-sealevel' => '$1 Metres above sea level',
3921 -'exif-gpsaltitude-below-sealevel' => '$1 Metres below sea level',
 3920+'exif-gpsaltitude-above-sealevel' => '$1 meters above sea level',
 3921+'exif-gpsaltitude-below-sealevel' => '$1 meters below sea level',
39223922
39233923 'exif-gpsstatus-a' => 'Measurement in progress',
39243924 'exif-gpsstatus-v' => 'Measurement interoperability',

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r69216Some fixups. esp related to GPSAltitude tag.bawolff20:24, 9 July 2010

Status & tagging log