Last modified: 2006-12-22 01:04:12 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 8335 - Image syntax does not parse "px" in image caption correctly
Image syntax does not parse "px" in image caption correctly
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
PC Windows XP
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
  Show dependency treegraph
Reported: 2006-12-20 12:35 UTC by brianna.laugher
Modified: 2006-12-22 01:04 UTC (History)
0 users

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


Description brianna.laugher 2006-12-20 12:35:21 UTC

When inserting an image in an article, if the image caption in an image ends in
"px", the image does not display correctly.

these display the entire image:

[[Image:Bratislava_New_Year_Fireworks.jpg|300px|this is 300px]]

this displays at 30px instead of 300px (but it is a kind of stupid thing to
write, anyway):


this displays correctly:

[[Image:Bratislava_New_Year_Fireworks.jpg|300px|300px image]]

Comment 1 Antoine "hashar" Musso (WMF) 2006-12-20 14:25:21 UTC
Fixed in r18465
Comment 2 Philippe Verdy 2006-12-20 19:11:11 UTC
Note that some pages contain images which are sized using a double "pxpx" suffix.
This generally occurs because of templates taking an image width in parameter,
and that
internally add the "px" suffix automatically, when the actual parameter already
that suffix.
Before r18465, parsing "30pxpx" with intval() worked (because the extra "px"
suffix is actually ignored);
but in r18465, it now checks if the parameter is_numeric(), which will fail with
"30px" (after the first
suffix was parsed and removed), but will work only with "30" (after the first
suffix was parsed and

One fix in r18465 is enough: just checking if $width is set before attempting to
parse it as a image size.
The second fix added, using is_numeric(), should be tested.

Check this:
[[Image:Bratislava_New_Year_Fireworks.jpg|300pxpx|300px image]]
This should still display a 300px thumbnail, not the full image.
Comment 3 Brion Vibber 2006-12-22 01:04:12 UTC
I've reverted part of the fix in r18483, so that the previous behavior is
restored for "300 px" and "300pxpx" cases.

It's a bit dubious, but this could use some general improvements. :)

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