Last modified: 2012-04-16 09:15:57 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T30076, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 28076 - Thumbnail feature in Special:listfiles doesn't handle very narrow images well.
Thumbnail feature in Special:listfiles doesn't handle very narrow images well.
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
unspecified
All All
: Normal trivial (vote)
: ---
Assigned To: Bryan Tong Minh
http://commons.wikimedia.org/w/index....
: patch, patch-need-review
: 28872 30605 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-03-16 16:03 UTC by Bawolff (Brian Wolff)
Modified: 2012-04-16 09:15 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Patch which modifies the way target width and height are calculated (3.34 KB, patch)
2011-04-22 19:16 UTC, Bryan Tong Minh
Details

Description Bawolff (Brian Wolff) 2011-03-16 16:03:56 UTC
I saw bug 3341, was fixed, and was looking at my uploads on commons. I noticed that the special:listfiles doesn't handle extremely narrow images very well.

For example: http://commons.wikimedia.org/w/index.php?title=Special:ListFiles&offset=Wn-gradient.pn&sort=img_name&limit=1

Observed behaviour: thumbnail is 180x80820 px (!)

Expected behaviour: In extreme cases such as this, don't scale it so it fulls the width of the entire column. I think a reasonable max width cut off would be 500px.
Comment 1 Bryan Tong Minh 2011-03-16 22:10:12 UTC
2:1 would be most appropriate I think, so 360px. I believe that passing 360 as height to File::transform is sufficient for MediaHandler to box-fit the image, but I'd need to check that to be certain.
Comment 2 Jon Harald Søby 2011-03-22 02:31:02 UTC
A related issue is that images that are smaller than the default thumbnail should not be scaled up, but kept the original size. Is that feasible? That would probably also half-way solve the problem of tall files, since the huge height is a side-effect of scaling up very narrow images.
Comment 3 Bryan Tong Minh 2011-04-22 18:58:17 UTC
Hmm this is more difficult than I thought... How do you properly scale a 1x449 image to 360 pixels height? The proper height would be 0.80 pixels and for various reasons MediaWiki will floor this to 0.
Comment 4 Bryan Tong Minh 2011-04-22 19:16:49 UTC
Created attachment 8449 [details]
Patch which modifies the way target width and height are calculated

Fixed in attached patch, but I had to modify the backend parameter normalization functions is a nasty way to ensure that the minimum image width is always 1 pixel.
Comment 5 Mark A. Hershberger 2011-04-23 03:25:32 UTC
are you planning to do anything else with this patch?  Apply it, say?  We'll at least look at it in triage.
Comment 6 Bryan Tong Minh 2011-04-23 09:09:20 UTC
I'd like to have somebody look over the patch before I apply it. I'm not convinced of the sanity of my changes to Generic.php.
Comment 7 Bawolff (Brian Wolff) 2011-04-23 16:01:43 UTC
At the end of the day, such narrow images are an edgecase. I don't think it'd be that bad if they just weren't rendered in the thumbnail spot.
Comment 8 Mark A. Hershberger 2011-04-23 19:06:36 UTC
(In reply to comment #7)
> At the end of the day, such narrow images are an edgecase. I don't think it'd
> be that bad if they just weren't rendered in the thumbnail spot.

I'd rather have the patch that can handle edge cases somewhat sanely.  If we just don't render, we'll end up explaining over and over why not rendering the thumbnail is the right thing to do.
Comment 9 Bryan Tong Minh 2011-04-23 19:09:32 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > At the end of the day, such narrow images are an edgecase. I don't think it'd
> > be that bad if they just weren't rendered in the thumbnail spot.
> 
> I'd rather have the patch that can handle edge cases somewhat sanely.  If we
> just don't render, we'll end up explaining over and over why not rendering the
> thumbnail is the right thing to do.

Indeed. It should also solve an edge case that is currently already occurring, when specifying a maximum height for an 1px-wide image. See http://test.wikipedia.org/wiki/Bug_28076
Comment 10 Brion Vibber 2011-04-25 23:38:19 UTC
This patch seems to have two parts:
* fix Special:Listfiles specifically to use a maximum box height (easy one-line fix)
* a general change to thumbnailing box sizing

Is that general change to ensure to that we have a minimum width and height of 1? Will it affect anything else? Does our resizing code that tries to match ImageMagick need adjusting?
Comment 11 Bryan Tong Minh 2011-04-26 08:07:11 UTC
(In reply to comment #10)
> This patch seems to have two parts:
> * fix Special:Listfiles specifically to use a maximum box height (easy one-line
> fix)
Correct, that is indeed only the one line change to SpecialListfiles.php

> * a general change to thumbnailing box sizing
Correct, that should fix the bug that is present on http://test.wikipedia.org/wiki/Bug_28076

> Is that general change to ensure to that we have a minimum width and height of
> 1? Will it affect anything else? Does our resizing code that tries to match
> ImageMagick need adjusting?
The change ensures a minimum width of 1 pixel. As for ImageMagick, we specify the exact size, not the shrink factor, so that should not be a problem. 

I just ran parserTests and it appears that some errors appear which may be due to this patch.

I could just commit the SpecialListfiles.php patch and open a new bug for the thumbnail sizing bug... They are two only indirectly related bugs.
Comment 12 Mark A. Hershberger 2011-04-27 22:59:25 UTC
(In reply to comment #11)
> I could just commit the SpecialListfiles.php patch and open a new bug for the
> thumbnail sizing bug...

I think that would be good.
Comment 13 Bryan Tong Minh 2011-04-30 18:55:53 UTC
Fixed in r87171, new bug logged on bug 28762.
Comment 14 db [inactive,noenotif] 2011-05-07 16:58:20 UTC
*** Bug 28872 has been marked as a duplicate of this bug. ***
Comment 15 Bryan Tong Minh 2011-08-29 07:25:29 UTC
*** Bug 30605 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links