From b3d77feb83431fda5e378b100efa39d929cf2133 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Thu, 28 Aug 2008 16:31:54 +0000 Subject: [PATCH] Implements #11884 : Now support Flash EXIF attribute --- RELEASE-NOTES | 1 + includes/Exif.php | 23 ++++++++++++++++++++++- languages/messages/MessagesEn.php | 11 +++++++++++ maintenance/language/messageTypes.inc | 10 ++++++++++ maintenance/language/messages.inc | 13 +++++++++++++ 5 files changed, 57 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index ef73bdfc09..113c8c4970 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -100,6 +100,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN backwards incompatibility with upload extensions. * BMP images are now displayed as PNG * (bug 13471) Added NUMBERINGROUP magic word +* (bug 11884) Now support Flash EXIF attribute === Bug fixes in 1.14 === diff --git a/includes/Exif.php b/includes/Exif.php index bd93eb76b2..3c1b1ab356 100644 --- a/includes/Exif.php +++ b/includes/Exif.php @@ -780,7 +780,28 @@ class FormatExif { } break; - // TODO: Flash + case 'Flash': + $flashDecode = array( + 'fired' => $val & bindec( '00000001' ), + 'return' => ($val & bindec( '00000110' )) >> 1, + 'mode' => ($val & bindec( '00011000' )) >> 3, + 'function' => ($val & bindec( '00100000' )) >> 5, + 'redeye' => ($val & bindec( '01000000' )) >> 6, +// 'reserved' => ($val & bindec( '10000000' )) >> 7, + ); + + # We do not need to handle unknown values since all are used. + foreach( $flashDecode as $subTag => $subValue ) { + # We do not need any message for zeroed values. + if( $subTag != 'fired' && $subValue == 0) { + continue; + } + $fullTag = $tag . '-' . $subTag ; + $flashMsgs[] = $this->msg( $fullTag, $subValue ); + } + $tags[$tag] = join( ',', $flashMsgs ); + break; + case 'FocalPlaneResolutionUnit': switch( $val ) { case 2: diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index f318dbb08d..252c7a3b98 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -3188,6 +3188,17 @@ Others will be hidden by default. 'exif-lightsource-24' => 'ISO studio tungsten', 'exif-lightsource-255' => 'Other light source', +'exif-flash-fired-0' => 'Flash did not fire', +'exif-flash-fired-1' => 'Flash fired', +'exif-flash-return-0' => 'no strobe return detection function', +'exif-flash-return-2' => 'strobe return light not detected', +'exif-flash-return-3' => 'strobe return light detected', +'exif-flash-mode-1' => 'compuslory flash firing', +'exif-flash-mode-2' => 'compuslory flash suppression', +'exif-flash-mode-3' => 'auto mode', +'exif-flash-function-1' => 'No flash function', +'exif-flash-redeye-1' => 'red-eye reduction mode', + 'exif-focalplaneresolutionunit-2' => 'inches', 'exif-sensingmethod-1' => 'Undefined', diff --git a/maintenance/language/messageTypes.inc b/maintenance/language/messageTypes.inc index 2c4a938058..0edb61ffa2 100644 --- a/maintenance/language/messageTypes.inc +++ b/maintenance/language/messageTypes.inc @@ -486,6 +486,16 @@ $wgEXIFMessages = array( 'exif-lightsource-19', 'exif-lightsource-24', 'exif-lightsource-255', + 'exif-flash-fired-0' , + 'exif-flash-fired-1' , + 'exif-flash-return-0' , + 'exif-flash-return-2' , + 'exif-flash-return-3' , + 'exif-flash-mode-1' , + 'exif-flash-mode-2' , + 'exif-flash-mode-3' , + 'exif-flash-function-1' , + 'exif-flash-redeye-1' , 'exif-focalplaneresolutionunit-2', 'exif-sensingmethod-1', 'exif-sensingmethod-2', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index bce227c05e..91c7a347d6 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -2341,6 +2341,18 @@ $wgMessageStructure = array( 'exif-lightsource-24', 'exif-lightsource-255', ), + 'exif-flash' => array( + 'exif-flash-fired-0' , + 'exif-flash-fired-1' , + 'exif-flash-return-0' , + 'exif-flash-return-2' , + 'exif-flash-return-3' , + 'exif-flash-mode-1' , + 'exif-flash-mode-2' , + 'exif-flash-mode-3' , + 'exif-flash-function-1' , + 'exif-flash-redeye-1' , + ), 'exif-focalplaneresolutionunit' => array( 'exif-focalplaneresolutionunit-2', ), @@ -2821,6 +2833,7 @@ Variants for Chinese language", 'exif-subjectdistance-value' => '', 'exif-meteringmode' => '', 'exif-lightsource' => '', + 'exif-flash' => 'Flash modes', 'exif-focalplaneresolutionunit' => '', 'exif-sensingmethod' => '', 'exif-filesource' => '', -- 2.20.1