MediaWiki r67616 - Code Review

Jump to: navigation, search
Revision:r67615‎ | r67616 (on ViewVC)‎ | r67617 >
Date:12:40, 8 June 2010
Status:ok (Comments)
* (bug 23835) Need "thumbmime" result in "imageinfo" query
Modified paths:

Diff [purge]

Loading diff…


#Comment by Bryan (talk | contribs)   09:34, 18 June 2010

Won't this fail for wikis which use a 404 handler to generate thumbnails?

#Comment by Reedy (talk | contribs)   11:08, 18 June 2010

I've no idea. Can you provide an example?

#Comment by Bryan (talk | contribs)   11:18, 18 June 2010

Just looked a bit more careful at the code and it does not appear to be a problem. $file->transform will not actually generate a thumbnail, but only a link to where the thumbnail is supposed to be. The thumbnail may or may not exist already depending on whether it was previously requested. The 404 handler will create the thumbnail only when it is actually requested. UnregisteredLocalFile::getMimeType will eventually call MimeMagic::guestMimeType. There is a lot of magic in there that tries to guess the MIME type from the file contents, but it looks like it will handle a non-existent file properly.

Still is there no way to get the MIME type from the MediaTransformOutput directly?

#Comment by Reedy (talk | contribs)   11:38, 18 June 2010

Doesn't seem to be. has nothing...

Unless we were to add it

#Comment by Bryan (talk | contribs)   13:02, 18 June 2010

It is apparently defined in the ImageHandler. $file->getHandler()->getThumbType() should do the trick.

#Comment by Reedy (talk | contribs)   17:38, 20 June 2010
00142         function getThumbType( $ext, $mime ) {
00143                 return array( $ext, $mime );
00144         }



We need to pass it stuff, but that's a MediaTransformOutput, which is limited. And as per the bug, the extension, and hence mime might not be the same as the original

Status & tagging log

  • 18:23, 8 June 2010 Catrope (talk | contribs) changed the status of r67616 [removed: new added: ok]