From 100ecff40ebd98c790379b09ef84adeae50e80a4 Mon Sep 17 00:00:00 2001 From: Bryan Tong Minh Date: Sat, 2 Apr 2011 14:49:12 +0000 Subject: [PATCH] Get the thumbmime from the handler instead of guessing it with UnregisteredLocalFile. --- includes/api/ApiQueryImageInfo.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/includes/api/ApiQueryImageInfo.php b/includes/api/ApiQueryImageInfo.php index 5321a430c3..c3cce33676 100644 --- a/includes/api/ApiQueryImageInfo.php +++ b/includes/api/ApiQueryImageInfo.php @@ -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(); -- 2.20.1