From: Bryan Tong Minh Date: Sat, 2 Apr 2011 14:49:12 +0000 (+0000) Subject: Get the thumbmime from the handler instead of guessing it with UnregisteredLocalFile. X-Git-Tag: 1.31.0-rc.0~31077 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/journal.php?a=commitdiff_plain;h=100ecff40ebd98c790379b09ef84adeae50e80a4;p=lhc%2Fweb%2Fwiklou.git Get the thumbmime from the handler instead of guessing it with UnregisteredLocalFile. --- 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();