Extension:MediaFunctions

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

Release status: beta

Implementation Parser function
Description Provides various parser functions to obtain properties of media files
Author(s) Rob Church
Last version 1.1 (January 11, 2008)
MediaWiki 1.11alpha
License No license specified
Download Download snapshot
Subversion [Help]

Browse source code
View code changes

Check usage (experimental)

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.

Contents

[edit] Requirements

The MediaFunctions extension requires MediaWiki 1.11alpha or later.

[edit] Installation

  1. Check out all extension files from Subversion and place them in a MediaFunctions subdirectory within your MediaWiki extensions directory
  2. Add the line require_once( "{$IP}/extensions/MediaFunctions/MediaFunctions.php" ); to your LocalSettings.php file

Installation can be verified through the Special:Version page on the wiki.

[edit] Functions

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).

[edit] See also

Personal tools
Namespaces
Variants
Actions
Site
Support
Download
Development
Communication
Print/export
Toolbox