Get the thumbmime from the handler instead of guessing it with UnregisteredLocalFile.
authorBryan Tong Minh <btongminh@users.mediawiki.org>
Sat, 2 Apr 2011 14:49:12 +0000 (14:49 +0000)
committerBryan Tong Minh <btongminh@users.mediawiki.org>
Sat, 2 Apr 2011 14:49:12 +0000 (14:49 +0000)
includes/api/ApiQueryImageInfo.php

index 5321a43..c3cce33 100644 (file)
@@ -357,9 +357,11 @@ class ApiQueryImageInfo extends ApiQueryBase {
                                                $vals['thumbheight'] = intval( $file->getHeight() );
                                        }
 
-                                       if ( isset( $prop['thumbmime'] ) ) {
-                                               $thumbFile = UnregisteredLocalFile::newFromPath( $mto->getPath(), false );
-                                               $vals['thumbmime'] = $thumbFile->getMimeType();
+                                       if ( isset( $prop['thumbmime'] ) && $file->getHandler() ) {
+                                               list( $ext, $mime ) = $file->getHandler()->getThumbType( 
+                                                       substr( $mto->getPath(), strrpos( $mto->getPath(), '.' ) + 1 ), 
+                                                       $file->getMimeType(), $thumbParams );
+                                               $vals['thumbmime'] = $mime;
                                        }
                                } else if ( $mto && $mto->isError() ) {
                                        $vals['thumberror'] = $mto->toText();