http://www.mediawiki.org/wiki/Special:Code/MediaWiki/95179

Revision: 95179
Author:   bawolff
Date:     2011-08-21 21:07:15 +0000 (Sun, 21 Aug 2011)
Log Message:
-----------
Follow-up r95155 - Make PagedTiffHandler use the new method to make sure the 
Exif support takes endian-ness of the tiff file into account

(needed because php's exif plugin doesn't do it for us... Only affects a few 
obscure props)

Also while I am here - change the FormatExif call to FormatMetadata (FormatExif 
is deprecated).
Also remove the htmlspecialchars - it doesn't make sense at this point, the 
result of that method is
fed through the parser in ImagePage.php and it will screw up formatting of Exif 
properties that
have multiple values (are arrays) and should be displayed as a list.

Modified Paths:
--------------
    trunk/extensions/PagedTiffHandler/PagedTiffHandler.image.php
    trunk/extensions/PagedTiffHandler/PagedTiffHandler_body.php

Modified: trunk/extensions/PagedTiffHandler/PagedTiffHandler.image.php
===================================================================
--- trunk/extensions/PagedTiffHandler/PagedTiffHandler.image.php        
2011-08-21 20:22:22 UTC (rev 95178)
+++ trunk/extensions/PagedTiffHandler/PagedTiffHandler.image.php        
2011-08-21 21:07:15 UTC (rev 95179)
@@ -170,8 +170,14 @@
                                $this->_meta['exif'] = $data;
                        } elseif ( $wgShowEXIF ) {
                                wfDebug( __METHOD__ . ": using internal Exif( 
{$this->mFilename} )\n" );
-                               $exif = new Exif( $this->mFilename );
-                               $data = $exif->getFilteredData();
+                               if ( method_exists( 'BitmapMetadataHandler', 
'Tiff' ) ) {
+                                       $data = BitmapMetadataHandler::Tiff( 
$this->mFilename );
+                               } else {
+                                       // old method for back compat.
+                                       $exif = new Exif( $this->mFilename );
+                                       $data = $exif->getFilteredData();
+                               }
+
                                if ( $data ) {
                                        $data['MEDIAWIKI_EXIF_VERSION'] = 
Exif::version();
                                        $this->_meta['exif'] = $data;
@@ -493,4 +499,4 @@
        function hasErrors() {
                return !empty( $this->metadata['errors'] );
        }
-}
\ No newline at end of file
+}

Modified: trunk/extensions/PagedTiffHandler/PagedTiffHandler_body.php
===================================================================
--- trunk/extensions/PagedTiffHandler/PagedTiffHandler_body.php 2011-08-21 
20:22:22 UTC (rev 95178)
+++ trunk/extensions/PagedTiffHandler/PagedTiffHandler_body.php 2011-08-21 
21:07:15 UTC (rev 95179)
@@ -610,9 +610,15 @@
                        return false;
                }
                unset( $exif['MEDIAWIKI_EXIF_VERSION'] );
-               $format = new FormatExif( $exif );
+               if ( class_exists( 'FormatMetadata' ) ) {
+                       // 1.18+
+                       $formatted = FormatMetadata::getFormattedData( $exif );
+               } else {
+                       // 1.17 and earlier.
+                       $format = new FormatExif( $exif );
 
-               $formatted = $format->getFormattedData();
+                       $formatted = $format->getFormattedData();
+               }
                // Sort fields into visible and collapsed
                $visibleFields = $this->visibleMetadataFields();
                foreach ( $formatted as $name => $value ) {
@@ -621,7 +627,7 @@
                                in_array( $tag, $visibleFields ) ? 'visible' : 
'collapsed',
                                'exif',
                                $tag,
-                               htmlspecialchars( $value )
+                               $value
                        );
                }
                $meta = unserialize( $metadata );


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to