Images specified with size foopxpx render at native size
Closed, ResolvedPublic

Description

If a stub template includes an image size declaration that includes "px" then that image is shown at native resolution in the editor.

This was observed with [[Template:Cornwall-stub]] which originally had the code:
{{asbox

image = Flag of Cornwall.svg
pix = 30px
subject = [[Cornwall]]
category = Cornwall stubs
name = Template:Cornwall-stub

}}

When the "pix" parameter was changed to just "30" [https://en.wikipedia.org/w/index.php?title=Template:Cornwall-stub&diff=564819917&oldid=547286019] as was used by e.g. [[Template:Nigeria-stub]] the image size was displayed correctly. The icon has been rendering at correct size when rendered for reading, presumably since [https://en.wikipedia.org/w/index.php?title=Template:Cornwall-stub&diff=next&oldid=235904748 2009].

Interestingly it renders as intended in VE when the template is initially placed, but does on every subsequent time it's opened in VE.

Feel free to use [[User:Thryduulf/stubtemplate]] for testing (I'll leave it up at least until this bug is closed) as I have altered the actual Cornwall-stub template.


Version: unspecified
Severity: normal
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=51826

Details

bzimport set Reference to bz51628.
  • Bug 51845 has been marked as a duplicate of this bug. ***
  • Bug 51826 has been marked as a duplicate of this bug. ***

We are supporting localized option patterns. In this case we get something like $1px, which does not match 30pxpx. We need to investigate why this works in the PHP parser, but not in Parsoid.

  • Bug 54371 has been marked as a duplicate of this bug. ***

Another concrete example:
http://parsoid.wmflabs.org/arwiki/%D9%85%D8%B7%D8%A7%D8%B1_%D8%B3%D9%8A%D8%B3%D9%8A%D9%85%D9%8A%D9%88%D8%AA?oldid=11661406

This bug increases a little bit the size of the offline dumps. I have estimated for example that on arwiki, ~200 pictures (calls) are impacted.

It seems that the PHP related code is the function parseWidthParam() in Parser.php (but this doesn't seems to support things lik "$1px".

Yes, 'pxpx' is actually a "feature". See bug 13500.

Working on a fix...

(In reply to C. Scott Ananian from comment #8)

Yes, 'pxpx' is actually a "feature". See bug 13500.

groan!

Change 114345 had a related patch set uploaded by Cscott:
Support trailing 'pxpx' in image size options.

https://gerrit.wikimedia.org/r/114345

Change 114345 merged by jenkins-bot:
Support trailing 'pxpx' in image size options.

https://gerrit.wikimedia.org/r/114345

Add Comment