How To Display Image Gallery From A Category In MediaWiki?

You can display a gallery of all images from a category in your MediaWiki website. Category Gallery is a MediaWiki extension that implements tag to automatically generate a gallery of all images in specified category.

The extension is easy to setup and use on any MediaWiki website. Start by downloading extension from GitHub and then follow the steps:

Upload the downloaded file file in ‘Extensions’ directory of your MediaWiki website, extract all files and make sure they all are placed in a directory called CategoryGallery in your extensions/ folder.

Now add the following code in your LocalSettings.php which is present in your site’s root directory:

require_once “$IP/extensions/CategoryGallery/CategoryGallery.php”;

That’s it. The feature is ready to use on any MediaWiki page.

How To Display Gallery Of Images From A Category?

To show a gallery of all images in category general, use the code like this:

<categorygallery cat="general"/>

Also, you may abbreviate it as catgallery:

<catgallery cat="general"/>

The given tag itself takes several additional parameters, specified as attribute name-value pairs:

<catgallery {parameters}/>


  • caption="{caption}": (caption text between double quotes for more than a word) sets a caption centered atop the gallery.
  • widths={width}px: sets the widths of the images, default 120px. Note the plural, widths
  • heights={heights}px: sets the (max) heights of the images.
  • perrow={integer}: sets the number of images per row. 0 means automatically adjust based on width of screen
  • showfilename={anything}: Show the filenames of the images in the individual captions for each image (1.17+)
  • bdpcaption={property}: Show the metadata of the images in the individual captions for each image. This would requires Extension:BedellPenDragon to be installed and working on your MediaWiki website.

Since doesn’t force any subscription to let you read so voluntarily your contribution to let us continue publishing like that.

Leave a Reply