Extension:ImageSizeInfoFunctions
ImageSizeInfoFunctions Release status: stable |
|
---|---|
Implementation | Parser function |
Description | return image width and height in pixel |
Author(s) | Dario de Judicibus, (mantainer Giuseppe Briotti) |
Latest version | 1.0.1 (2009-01-24) |
MediaWiki | 1.8, 1.9, 1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17 |
License | No license specified |
Download | ImageSizeInfoFunctions.php |
Translate the ImageSizeInfoFunctions extension if it is available at translatewiki.net |
|
Check usage and version matrix; code metrics |
Contents
Introduction[edit | edit source]
ImageSizeInfoFunctions is an extension to MediaWiki that gives two parser functions returning width and height size of a given image, available in the wiki.
Its purpose is to make it easier to create a template for resizing an image in percentage instead of absolute size. This is useful for images gallery based on images of the same scale but different size.
Features[edit | edit source]
- imageWidth (imgw) returns the image width in pixel.
- imageHeight (imgh) returns the image height in pixel.
Installation[edit | edit source]
- Download ImageSizeInfoFunctions.php
- Download ImageSizeInfoFunctions.i18n.php
- Save both files in the new extensions/ImageSizeInfoFunctions directory of your wiki.
- Insert these lines in the LocalSettings.php file:
// Activate ImageSizeInfoFunctions extension include_once('extensions/ImageSizeInfoFunctions/ImageSizeInfoFunctions.php');
Configuration[edit | edit source]
no configuration required
Usage[edit | edit source]
As for all parser functions:
{{#imgw: [image name] }}
{{#imgh: [image name] }}
Template Example[edit | edit source]
This template is useful for scaling the given image by percentage or, as usual, by absolute size:
<includeonly>[[Image:{{{imagename}}}|{{ #if:{{#pos:{{{newwidth|100}}}|px}}|{{{newwidth|100}}}| {{#expr: ({{#imgw: {{{imagename}}} }} * {{{newwidth|100}}}) / 100 }}px }}|{{{caption|}}}]]</includeonly>
Thus, assuming that the template is called ScaleImage:
Scaling the image to 15%:
{{ScaleImage |imagename=eland.png |caption=Città di Eland |newwidth=15 }}
Scaling the image to 80 pixel:
{{ScaleImage |imagename=eland.png |caption=Città di Eland |newwidth=80px }}
Version history[edit | edit source]
- 0.0.1 - testing
- 1.0.0 - first stable release
- 1.0.1 - improvement suggested by G.Hagedorn in discussion page
Alternatives[edit | edit source]
Feedback[edit | edit source]
Use the discussion page for feedback, questions, feature requests and bug reports.