Extension:MediaFunctions
This extension is currently not actively maintained! Although it may still work, any bug reports or feature requests will more than likely be ignored. If you are interested in taking on the task of developing and maintaining this extension, you can request repository ownership. As a courtesy, you may want to contact the author. You should also remove this template and list yourself as maintaining the extension in the page's {{Extension }} infobox. |
MediaFunctions Release status: unmaintained |
|
---|---|
Implementation | Parser function |
Description | Provides various parser functions to obtain properties of media files |
Author(s) | Rob Church (Robchurchtalk) |
Latest version | 1.5.0 (2020-04-14) |
MediaWiki | 1.29+ |
PHP | 5.5+ |
Database changes | No |
License | BSD 2-clause "Simplified" License |
Download | |
Quarterly downloads | 7 (Ranked 118th) |
Translate the MediaFunctions extension if it is available at translatewiki.net | |
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]- Download and move the extracted
MediaFunctions
folder to yourextensions/
directory.
Developers and code contributors should install the extension from Git instead, using:cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/MediaFunctions - Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'MediaFunctions' );
- Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
To users running MediaWiki 1.35 or earlier:
The instructions above describe the new way of installing this extension using wfLoadExtension()
.
If you need to install this extension on these earlier versions (MediaWiki 1.35 and earlier), instead of wfLoadExtension( 'MediaFunctions' );
, you need to use:
require_once "$IP/extensions/MediaFunctions/MediaFunctions.php";
Usage
[edit]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). |