Last modified: 2014-05-21 18:17:24 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 T64258, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 62258 - Sizing of `framed` images
Sizing of `framed` images
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
1.23.0
All All
: Normal normal (vote)
: ---
Assigned To: C. Scott Ananian
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-03-05 15:04 UTC by C. Scott Ananian
Modified: 2014-05-21 18:17 UTC (History)
8 users (show)

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


Attachments

Description C. Scott Ananian 2014-03-05 15:04:49 UTC
https://www.mediawiki.org/wiki/Help:Images#Size_and_frame says:

> An image with frame always ignores the size specification, the original image
> will be reduced if it exceeds the maximum size defined in user preferences.

However, as bug 53514 describes, the actual behavior seems to have regressed at some point.  The code in includes/Linker.php to check the user preference for size (which seems to be the same as the thumbnail size preference) is unreachable.  As presently written, framed images are always rendered at their "natural" size, *unless a height* is specified, in which case the height is honored (and the width, if any, ignored).

It's not entirely clear what the proper fix should be.  There are three options:

1. Leave the code as is, and update the spec on the wiki.
2. If a height is specified, honor the height *and* width (conservative, should change few pages)
3. Implement what I think was the original idea: *always* ignore the width and height, and limit the maximum image size with the user's thumbnail size preference.
Comment 1 James Forrester 2014-03-05 16:22:18 UTC
(In reply to C. Scott Ananian from comment #0)
> https://www.mediawiki.org/wiki/Help:Images#Size_and_frame says:
> 
> > An image with frame always ignores the size specification, the original image
> > will be reduced if it exceeds the maximum size defined in user preferences.
> 
> However, as bug 53514 describes, the actual behavior seems to have regressed
> at some point.  The code in includes/Linker.php to check the user preference
> for size (which seems to be the same as the thumbnail size preference) is
> unreachable.  As presently written, framed images are always rendered at
> their "natural" size, *unless a height* is specified, in which case the
> height is honored (and the width, if any, ignored).
> 
> It's not entirely clear what the proper fix should be.  There are three
> options:
> 
> 1. Leave the code as is, and update the spec on the wiki.
> 2. If a height is specified, honor the height *and* width (conservative,
> should change few pages)
> 3. Implement what I think was the original idea: *always* ignore the width
> and height, and limit the maximum image size with the user's thumbnail size
> preference.

I think option 2 is best; option 3 would be quite disruptive given that I think this is how it's been for a while (getting out git blame here might be interesting), so people aren't expecting this fundamental a thing to change much. We should talk to the Multimedia team a bit here to check with them, though.

However, MediaWiki's image system needs some serious review, and I don't think a bug is the place to do it. Some possible questions, just to illustrate:

*Why* does a frame image work like a thumb image except for the thumbnail and the magnifying glass icon?

*Why* does frameless not operate like frame with respect to size, but does for everything else? (Though that might be just this bug, I guess?)

*Why* are galleries fundamentally different in options and some of the new gallery options like hover-caption aren't implemented?

Given that the proposed changes to Vector (but not Monobook, and not MediaWiki core?) in Typography Update remove the frame from frame and thumb images, should those options be merged? Should the wikitext for "thumb" be killed off? Should |border=1 still work in these cases? Why?

… etc.
Comment 2 Mark Holmquist 2014-03-05 17:26:56 UTC
As you say, James, these are mostly questions for an RFC, and not really relevant here, though maybe blockers. A separate bug is called for.

For what it's worth I would err in the direction of following the spec, but without a complaining user it may just be that the spec has fallen out of favour with reality. I would suggest asking on VPT and a few other sites that use lots of images in their work - Wikibooks and Commons come to mind - and maybe getting some CL time to help you sort out the replies, and post to more languages than just English.

HTH...
Comment 3 Gerrit Notification Bot 2014-03-05 17:29:49 UTC
Change 116995 had a related patch set uploaded by Cscott:
Ignore height as well as width for framed images.

https://gerrit.wikimedia.org/r/116995
Comment 4 Gabriel Wicke 2014-03-08 02:52:06 UTC
Parsoid commit https://gerrit.wikimedia.org/r/#/c/116983/ makes Parsoid match the old (broken) behavior. We'll need to partly undo it once this bug is fixed.
Comment 5 C. Scott Ananian 2014-04-03 16:10:40 UTC
To be specific, the reason why framed images respect height (but not width) is because the linker uses:
  $thumb = $file->getUnscaledThumb( $hp );
but includes/filerepo/file/File.php::getUnscaledThumb forces the requested width to be the same as the images natural width *but not the height*.  So if there is a height specification, getUnscaledThumb actually returns a scaled thumb.  Which is... a bug.

https://gerrit.wikimedia.org/r/116995 fixes this, but probably in the wrong way (unsets height for framed images).  File::getUnscaledThumb should probably be fixed so that it ignores the specified height if present.
Comment 6 C. Scott Ananian 2014-04-10 18:11:36 UTC
The patch attached to https://gerrit.wikimedia.org/r/116995 now fixes the bug in the "right way" -- that is, it fixes File::getUnscaledThumb.

This will change the size of all images which combine a height bound and a framed image.

In order to determine whether fixing this bug will affect this display of too many images, I wrote a script to grunge through all images and pages containing images on a wiki.  See https://github.com/cscott/wp-image-info

One limitation is that it uses the wp allimages API query, so it does not include pages which include images *only from commons*.

I'm still collecting data for enwiki, but for frwiki:
   43,014 total non-commons images
    8,839 of them are in portrait orientation
1,242,985 image links on pages, of which only
       60 use the 'framed' option with a height bound

For dewiki:
  170,701 total non-commons images
   55,208 of these are in portrait orientation
1,786,779 image links on pages, of which only
      538 use the 'framed' option with a height bound

I fixed some of these:
https://de.wikipedia.org/w/index.php?title=Hauptkirche_Sankt_Michaelis_%28Hamburg%29&diff=129396939&oldid=129292349
https://de.wikipedia.org/w/index.php?title=Ceylor&diff=129396510&oldid=129332266
https://de.wikipedia.org/w/index.php?title=Ceylor&diff=129396510&oldid=129332266
Comment 7 C. Scott Ananian 2014-04-10 18:29:16 UTC
Sorry, my stats were slightly wrong above:
frwiki: 
  60 image links using the "framed" option
   1 of which uses a height bound
dewiki:
 538 image links using the "framed" option
  20 of which use a height bound

So on dewiki/frwiki I've only been about to find 21 image links whose size would be changed by this bug fix.  I'm still collecting data on enwiki, I'll update this bug with the numbers when I have them.
Comment 8 C. Scott Ananian 2014-04-10 18:37:23 UTC
Full list for dewiki:
Ceylor Datei:Lochtest.png x206px
Ceylor Datei:Volumentest.png x206px
Fernsehwerbung Datei:Werbeanteile.png x200px
Fahrtanzeiger Datei:FSM_WT.png 500x300px
Friedrich Glauner Datei:Grafik_Wertetrichter_unterlegt.png 480x367px
Gliederung des Feldheeres (Bundeswehr, Heeresstruktur 4) Datei:II._Korps.svg x150px
Gliederung des Feldheeres (Bundeswehr, Heeresstruktur 4) Datei:III._Korps.svg x150px
Gliederung des Feldheeres (Bundeswehr, Heeresstruktur 4) Datei:I._Korps.svg x150px
Hauptkirche Sankt Michaelis (Hamburg) Datei:Oratorium_zur_Einweyhung_der_Michaeliskirche_1762.JPG 180x180px
Opernhaus vorm Salztor Datei:Salztor_NMB_1800.JPG 200x200px
Opernhaus vorm Salztor Datei:Karte_NB_Oper.jpg 300x300px
Raketenartilleriebataillon Datei:APP-6_MLRS.svg x80px
Reedschalter Datei:Form_A_-_Schließer_(Normally_Open).jpg x50px
Reedschalter Datei:Form_C_-Wechsler_bzw._Umschalter.jpg x50px
Rheintal-Express Datei:Rheintal-Express_RABe_511.jpg 260x260px
SV Salamander Kornwestheim Datei:Logo_TV_Kornwestheim_Kodiaks.gif x130px
STUDIOPARK KinderMedienZentrum Datei:STUDIOPARK_KinderMedienZentrum.png x100px
ToiToiToi Datei:Toitoitoi-symbole.svg x70px
Spotlight (Software) Datei:Spotlight-Suche_im_Finder.png x222px
Zwergsignal Datei:Zs-beispiel1.png 500x300px
Comment 9 Andre Klapper 2014-04-10 19:01:00 UTC
(In reply to comment #8)
cscott had already fixed the pages "Gliederung des Feldheeres (Bundeswehr, Heeresstruktur 4)", "Hauptkirche Sankt Michaelis (Hamburg)", and "Ceylor" and I've fixed the rest now on de.wp.
Comment 10 Gerrit Notification Bot 2014-04-14 20:08:01 UTC
Change 116995 merged by jenkins-bot:
Ignore height as well as width for framed images.

https://gerrit.wikimedia.org/r/116995
Comment 11 Gerrit Notification Bot 2014-04-14 20:55:48 UTC
Change 125876 had a related patch set uploaded by Cscott:
Update release notes to describe user-visible change to framed images.

https://gerrit.wikimedia.org/r/125876
Comment 12 Gerrit Notification Bot 2014-04-14 21:16:23 UTC
Change 125876 merged by jenkins-bot:
Update release notes to describe user-visible change to framed images.

https://gerrit.wikimedia.org/r/125876
Comment 13 Gerrit Notification Bot 2014-04-14 21:43:09 UTC
Change 125885 had a related patch set uploaded by Cscott:
Match fixed PHP behavior for framed images with a height specification.

https://gerrit.wikimedia.org/r/125885
Comment 14 Gerrit Notification Bot 2014-04-15 15:59:52 UTC
Change 125885 merged by jenkins-bot:
Match fixed PHP behavior for framed images with a height specification.

https://gerrit.wikimedia.org/r/125885
Comment 15 Umherirrender 2014-04-27 15:31:32 UTC
You have missed the localized version at least for dewiki ("gerahmt"), see [1]
There are also english aliase ("enframed" and "frame")



[1] https://de.wikipedia.org/w/index.php?title=Airbus_A350&oldid=129797202#Zweiter_Entwurf
Comment 16 C. Scott Ananian 2014-05-15 19:32:38 UTC
We use the parsoid HTML for the page, so we do in fact handle localized option names.  However, the caveat in comment 6 applies: "One limitation is that it uses the wp allimages API query, so it does not include pages which include images *only from commons*."  That seems to have been the case on the page you link to.
Comment 17 Krinkle 2014-05-21 16:08:04 UTC
I can't be bothered to read through and interpret the logic of height bound and width bound and square cropped box ponies.

But I'm confused by two things:

1) I can understand why certain keywords should not result in a cropped image and thus for 'frame' to now only respect height of width. But ignoring both seems like a pointless change that is asking to break and upset existing content.

Existing usage like [[File:Example.jpg|frame]] would be unaffected, but existing content like [[File:Test wiki logo notext.png|frame|200x200px]] will not result in a gigantic 3000px image being framed on the page[1]


2) Wait, we made this change because some old Help documentation page[2] on mediawiki.org says[3] so? That's not by any means a specification. Also, that same exact documentation page has an example of [[File:Example.jpg|frame|50px]] which is now broken[4] by being way too large.

[1] https://www.mediawiki.org/w/index.php?title=VisualEditor:Test&oldid=1011846
[2] https://www.mediawiki.org/w/index.php?title=Help:Images&oldid=945436
[3] "An image with frame always ignores the size specification, the original image will be reduced if it exceeds the maximum size defined in user preferences."
[4] https://www.mediawiki.org/w/index.php?title=Help:Images&oldid=945436#Size_and_frame
Comment 18 Gabriel Wicke 2014-05-21 17:03:38 UTC
(In reply to Krinkle from comment #17)
> I can't be bothered to read through and interpret the logic of height bound
> and width bound and square cropped box ponies.
> 
> But I'm confused by two things:
> 
> 1) I can understand why certain keywords should not result in a cropped
> image and thus for 'frame' to now only respect height of width. But ignoring
> both seems like a pointless change that is asking to break and upset
> existing content.
> 
> Existing usage like [[File:Example.jpg|frame]] would be unaffected, but
> existing content like [[File:Test wiki logo notext.png|frame|200x200px]]
> will not result in a gigantic 3000px image being framed on the page[1]

Note that only 200x200px was scaled so far, and is rare in combination with frame. 200px was *not* scaled with frame, and still isn't.


> 2) Wait, we made this change because some old Help documentation page[2] on
> mediawiki.org says[3] so? That's not by any means a specification. Also,
> that same exact documentation page has an example of
> [[File:Example.jpg|frame|50px]] which is now broken[4] by being way too
> large.

There should be no change here at all. Framed images with only a width bbox specified were not scaled so far.

Gabriel
Comment 19 C. Scott Ananian 2014-05-21 18:17:24 UTC
I checked image documentation on mw as well as enwiki and other language-specific wikis, as well as reading the code.  It was clear that the intent was as documented -- framed images were original size.  They even called getUnscaledThumb in the code.  However, getUnscaledThumb had a bug so that it did not always return unscaled thumbs.  This affected a miniscule number of pages, all of which (upon examination) were really trying to do something else (usually 'thumb' not 'frame').  We fixed most of those pages, and fixed the bug.  This bug has been merged and closed for over a month now and is already live on all the wikis.  (See https://en.wikipedia.org/wiki/User:Cscott/framed )

I think you are actually trying to review the 'square bounding box' RfC -- which is Not This Bug.

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


Navigation
Links