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

bzimport added a project: Parsoid.Via ConduitNov 22 2014, 1:46 AM
bzimport set Reference to bz51628.
Thryduulf created this task.Via LegacyJul 18 2013, 6:14 PM
Catrope added a comment.Via ConduitJul 23 2013, 1:48 AM
  • Bug 51845 has been marked as a duplicate of this bug. ***
Catrope added a comment.Via ConduitJul 23 2013, 2:55 AM
  • Bug 51826 has been marked as a duplicate of this bug. ***
GWicke added a comment.Via ConduitAug 16 2013, 1:02 AM

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.

Thryduulf added a comment.Via ConduitOct 4 2013, 11:43 PM
  • Bug 54371 has been marked as a duplicate of this bug. ***
Kelson added a comment.Via ConduitNov 21 2013, 11:35 AM

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".

cscott added a comment.Via ConduitFeb 19 2014, 9:25 PM

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

Working on a fix...

ssastry added a comment.Via ConduitFeb 19 2014, 9:42 PM

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

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

groan!

gerritbot added a comment.Via ConduitFeb 19 2014, 9:53 PM

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

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

gerritbot added a comment.Via ConduitFeb 19 2014, 11:16 PM

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

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

Add Comment