Extension:ImageSizeInfoFunctions
From MediaWiki.org
|
ImageSizeInfoFunctions Release status: stable |
|
|---|---|
| Implementation | Parser function |
| Description | return image width and height in pixel |
| Author(s) | Dario de Judicibus, (mantainer Giuseppe Briotti) |
| Last 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 |
| Check usage and version matrix | |
Contents |
Introduction [edit]
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]
- imageWidth (imgw) returns the image width in pixel.
- imageHeight (imgh) returns the image height in pixel.
Installation [edit]
- 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]
no configuration required
Usage [edit]
As for all parser functions:
{{#imgw: [image name] }}
{{#imgh: [image name] }}
Template Example [edit]
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]
- 0.0.1 - testing
- 1.0.0 - first stable release
- 1.0.1 - improvement suggested by G.Hagedorn in discussion page
Alternatives [edit]
Feedback [edit]
Use the discussion page for feedback, questions, feature requests and bug reports.
