Page MenuHomePhabricator

MediaWiki tries to create a thumbnail multiple times although that is not needed
Open, MediumPublic

Description

From http://www.mediawiki.org/wiki/Thread:Project:Support_desk/Why_does_MediaWiki_try_to_create_the_same_thumbnail_multiple_times%3F

During one single request, MediaWiki tries to create one and the same thumbnail multiple times. This error happens, when it is not actually needed at all to create a thumbnail.

<b>How to reproduce:</b>

Create a page with this wiki text:
[[File:Image.png]]

Image.png must have a size, which can be rendered without any resizing. E.g. in my case it has 450x151 pixels.

<b>Actual result:</b>

When viewing the uncached page, MediaWiki <i>several times</i> tries to create a thumbnail with exactly the size of the original image.

Debug output:

<pre>
Start request GET /Main_Page
...
Pulling file metadata from cache key wiki:file:8866e45e917553a7dbb1198218cfa928
MimeMagic::construct: loading mime types from /www/wiki/includes/mime.types
MimeMagic::
construct: loading mime info from /www/wiki/includes/mime.info

File::transform: Doing stat for mwstore://local-backend/local-thumb/8/88/Image.png/450px-Image.png
FileBackendStore::getFileStat: File mwstore://local-backend/local-thumb/8/88/Image.png/450px-Image.png does not exist.
BitmapHandler::doTransform: creating 450x151 thumbnail at /tmp//transform_64c4649d3b12-1.png using scaler im
BitmapHandler::doTransform: returning unscaled image

File::transform: Doing stat for mwstore://local-backend/local-thumb/8/88/Image.png/450px-Image.png
BitmapHandler::doTransform: creating 450x151 thumbnail at /tmp//transform_40e462b65414-1.png using scaler im
BitmapHandler::doTransform: returning unscaled image

File::transform: Doing stat for mwstore://local-backend/local-thumb/8/88/Image.png/450px-Image.png
BitmapHandler::doTransform: creating 450x151 thumbnail at /tmp//transform_341bb62f6727-1.png using scaler im
BitmapHandler::doTransform: returning unscaled image
</pre>

<b>Expected result:</b>

  1. MediaWiki should recognize that it is not necessary to create a thumbnail in this size, as the thumbnail would have exactly the size of the original image.
  2. MediaWiki should only try to create the thumbnail ONE time, not three times.

Version: 1.21.x
Severity: normal

Details

Reference
bz49528