Last modified: 2006-12-22 01:04:12 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 T10335, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 8335 - Image syntax does not parse "px" in image caption correctly
Image syntax does not parse "px" in image caption correctly
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
unspecified
PC Windows XP
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  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: ---


Attachments

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

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]]
[[Image:Bratislava_New_Year_Fireworks.jpg|300px|px]]

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

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

this displays correctly:

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


thanks!
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
contains
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
removed).

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.


Navigation
Links