Jump to content

Extension:PictoCat

From mediawiki.org
MediaWiki extensions manual
PictoCat
Release status: beta
Implementation Skin
Description Adds image previews to categories
Author(s) Saucytalk
Latest version 0.3.0 (2026-07-02)
Compatibility policy Snapshots releases along with MediaWiki. Master is not backward compatible.
MediaWiki >= 1.45.0
Database changes No
Category
  • $wgPictoCatActivationPercentage
Licence GNU General Public License 2.0 or later
Download

The PictoCat (an abbreviation of "pictographic categories") extension displays a small image preview next to each page in a category . The image is sourced from the corresponding page and takes the place of the bullet point. The exact image used is determined by the PageImages extension.

PictoCat does not affect every category. By default, PictoCat will only activate on a category if at least 50% of its members (excluding files and subcategories) have a page image. The wiki's sysadmin can change this threshold by setting the relevant configuration parameter. You can override the default behavior for a particular category by using a magic word.

PictoCat does not affect the display of subcategories or files in a category. For files, this is because MediaWiki already displays a preview of each file. For subcategories, this is because most categories do not have page images, and regardless, this extension would conflict with the popular CategoryTree extension.

Dependencies

[edit]

Currently, PictoCat supports MediaWiki 1.45 or later, but not any earlier versions. It also requires Extension:PageImages to be installed.

Installation

[edit]
  • Ensure the dependencies are installed.
  • Download and place the file(s) in a directory called PictoCat in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'PictoCat' );
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

If you are unsure of anything, more detailed installation instructions are available in the readme.

Configuration parameters

[edit]
  • $wgPictoCatActivationPercentage — If less than this percent of members in a category (excluding files and subcategories) have a page image, then PictoCat will not insert images in that category.
    • This behavior can be overridden on a category-by-category basis by using the magic words.
    • Can be an int or a float, but any non-number value may cause an exception.
    • If set to 0 (or any negative number), then all categories will use PictoCat by default.
    • If set to 101 (or any number greater than 100), then no categories will use PictoCat by default. Effectively, each category would have to opt in using the magic words.
    • If a category is large, then it won't check every page member; it will only check the first 200 or so. The maximum number of members checked is controlled by $wgCategoryPagingLimit .
    • Default value: 50
    • Example usage: $wgPictoCatActivationPercentage = 25;

Overriding default behavior

[edit]

There are a few ways to force PictoCat's images to be included or omitted.

Magic words

[edit]

A set of magic words (behavior switches) is included to allow editors to explicitly set PictoCat's behavior in a particular category. You can use them by including one in the wikitext of a category page. No more than one of these should be used in a single category, otherwise there may be unexpected behavior. These magic words have no effect outside of the Category namespace.

Magic word Effect
__PICTOCAT__ Use PictoCat images in this category.
__NOPICTOCAT__ Do not use PictoCat images in this category.
__USEBULLETSTYLE__ Currently, this has the same effect as __PICTOCAT__. If additional display styles are added in the future, then categories with this magic word will continue using the current style.

User preferences

[edit]

There is a user preference that allows logged-in users to enable or disable PictoCat images for all categories (only for their account, of course). To use this, go to the Preferences page (Special:Preferences), and under the Appearance tab, scroll down to the "Category pages" section and change the "Show image previews in category pages" setting. Setting it to "Always" or "Never" will override any magic words or configuration settings.

For sysadmins: if (for some reason) you would like to change the default value of this setting, you can do so by setting $wgDefaultUserOptions['pictocat'] to be one of 'default', 'always', or 'never'.

URL parameters

[edit]

It is possible to specify PictoCat's behavior for a particular page visit by using a pictocat field in a URL query string, e.g., /wiki/Category:Example?pictocat=true. This will override any magic words, user preferences, and default behavior. The following parameters are recognized:

URL query substring Effect
  • pictocat=true
  • pictocat=yes
  • pictocat=bullet
Use PictoCat images in this category.
  • pictocat=false
  • pictocat=none
  • pictocat=no
Do not use PictoCat images in this category.