From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.svg

Release status:Extension status stable

ImplementationTemplate:Extension#type Parser function
DescriptionTemplate:Extension#description Provides various parser functions to obtain properties of media files
Author(s)Template:Extension#username Rob Church (Robchurchtalk)
Latest versionTemplate:Extension#version 1.4.0 (2017-07-19)
MediaWikiTemplate:Extension#mediawiki 1.23+
PHPTemplate:Extension#php 5.3+
Database changesTemplate:Extension#needs-updatephp No
LicenseTemplate:Extension#license BSD 2-clause "Simplified" License
Hooks usedTemplate:Extension#hook

Translate the MediaFunctions extension if it is available at translatewiki.net

Check usage and version matrix.

The MediaFunctions extension adds several parser functions to MediaWiki which provide access to properties and metadata of various media files in both local and remote repositories.


  • Download and place the file(s) in a directory called MediaFunctions in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/MediaFunctions/MediaFunctions.php";
  • YesY Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.


Function Syntax Description
mediamime {{#mediamime:Image:Filename.ext}} Returns the MIME type of the file
mediasize {{#mediasize:Image:Filename.ext}} Returns the size of the file
mediaheight {{#mediaheight:Image:Filename.ext}} Returns the height of the file, if it is an image
mediawidth {{#mediawidth:Image:Filename.ext}} Returns the width of the file, if it is an image
mediadimensions {{#mediadimensions:Image:Filename.ext}} Returns a formatted dimensions string for the image
mediapages {{#mediapages:Image:Filename.ext}} Returns the number of pages for paged media
mediaexif {{#mediaexif:Image:Filename.ext|exif field name|optional index for field}}
Returns one of the exif metadata fields. For array fields, takes a third parameter for the index of the field (Defaults to 0 if unspecified).