Extension:MediaFunctions

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
MediaFunctions

Release status: stable

Implementation Parser function
Description Provides various parser functions to obtain properties of media files
Author(s) Rob Church (Robchurchtalk)
Latest version 1.2.1 (2010-06-01)
MediaWiki 1.11+
Database changes No
License BSD
Download
Hooks used
ParserFirstCallInit

Translate the MediaFunctions extension if possible

Check usage and version matrix; code metrics

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.

Installation[edit | edit source]

  • Download and extract the files in a directory called MediaFunctions in your extensions/ folder. If you're a developer and this extension is in a Git repository, then instead you should clone the repository.
  • Add the following code at the bottom of your LocalSettings.php:
require_once( "$IP/extensions/MediaFunctions/MediaFunctions.php" );
  • Done! Navigate to "Special:Version" on your wiki to verify that the extension is successfully installed.

Usage[edit | edit source]

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}}
{{#mediaexif:Image:Filename.jpg|Artist}}
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).