Wikipedia:ClickFix

(Redirected from Wikipedia:PXPX)

This page was for coordinating discussion and correction efforts for the "pxpx" bug, but the "pxpx" bug has now been fixed in the MediaWiki software here at the English Wikipedia. MediaWiki now again tolerates image parameters like "40pxpx" and "40x40pxpx". (Note from 2023: This invalid size option has once again been disabled; see T207032 for details.)

However, those of you who need to handle multiple image size parameters and/or default sizes should still have good use of the template {{px}}.

History

edit

On March 25, 2008, MediaWiki revision 32391 (see also r32394) imposed tighter restrictions on acceptable values for the 'size' parameters in image tags. This caused a large number of image tags across Wikipedia (and presumably other projects) to become invalid, resulting in the image displaying at its default size. In many cases, the image is by default extremely large, resulting in corrupt display.

It was initially believed that the problem was an error in {{click}}, which is used to display, among other things, the small icons in the top-right of many userpages, creating some interesting displays. This is the origin of the name "ClickFix", which was given to the technical solution offered below. However, this issue actually applies to many templates and images across Wikipedia, and is not restricted to images in templates.

The most common cause of image tag corruption is when the image is displayed in a template. In many templates which include images by default, the size is a customisable parameter. If the suffix "px" is specified in both the template code and the template call when the image is transcluded, the effect is to duplicate the "px" - instead of "50px", the image tags receives "50pxpx". Prior to MediaWiki revision 32394, this was interpreted as an acceptable image size; it now isn't.

This is a newly discovered effect and there might be more to it, so this page might not be complete. Take a look at this page's talk page for the latest news.

Example

edit
Template code
[[Image:{{{image}}}|thumb|right|{{{size}}}px|A caption]]
Template calls
The code Is equivalent to Which produces
{{Template | image = Example.jpg | size = 50 }}
[[Image:Example.jpg|thumb|right|50px|A caption]]
 
A caption
{{Template | image = Example.jpg | size = 50px }}
[[Image:Example.jpg|thumb|right|50pxpx|A caption]]
 
A caption

Fixes

edit

If you find a page which is broken, but you can't easily fix it, list it at Wikipedia:ClickFix/Broken and it will be dealt with by someone who can.

Remove "px" from the template call

edit

If you see an image which is abnormally large or small, you can probably fix it by removing the "px" from the template call.

Use {{px}}

edit

The {{px}} meta-template can help a template, such as an infobox, to take image size parameters in both of the forms "40" or "40px". Then all the pages that call that template do not need to be updated. Read more about it at Template:Px.

More systematic fixes

edit

If you don't want to use {{px}} in the template to make it take image size parameters in both of the forms "40" or "40px", then you need to update all the calling pages to not use "40px" but only "40". Take a look at "what links here" for the template. If the number of calling pages is too large to simply check through them manually then here is a method to help you find which pages need updating:

If you have reason to suspect that a large number of the pages transcluding a particular template may have ClickFix errors, there is a more systematic method for collecting broken pages:

  1. Add the code <includeonly>{{#ifexist:User:MelonBot/ClickFix/{{{suspect_parameter}}}|[[Category:{{subst:PAGENAME}} needing ClickFix|{{PAGENAME}}]]}}</includeonly> to any template which may be affected, replacing suspect_parameter with the name of the parameter which may be holding duplicate "px" in instances (usually something like imagesize, width, etc).
  2. Create Category:TEMPLATE NAME needing ClickFix, with the following text:
    __HIDDENCAT__ [[Category:ClickFix maintenance categories]]
  3. Once they work their way through the job queue, broken instances will be categorised into this category, where they can be fixed manually, or by bot using suitable regexes.
  4. Once all the instances of a template have been "ClickFixed" - ie checked for duplicate "px" statements, list them at User:MelonBot/ClickFix.

All the maintenance categories produced by this fix are categorised into Category:ClickFix maintenance categories. All the pages categorised into one of these categories need fixing.