Extension:RandomImage/de-formal

From Linux Web Expert

MediaWiki extensions manual
RandomImage
Release status: stable
Implementation Tag
Description Adds a ‎<randomimage> tag to the parser allowing for randomisation of multimedia content on a page
Author(s) Rob Church (Robchurchtalk)
MediaWiki
License No license specified
Download
README

  • randomimage
Quarterly downloads Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
Public wikis using Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
Translate the RandomImage extension if it is available at translatewiki.net
Issues Open tasks · Report a bug

The RandomImage extension adds a ‎<randomimage> tag to the MediaWiki parser which allows for randomisation of multimedia content on a page.

When the tag is rendered, a random image is selected from those uploaded and inserted at the location of the tag. Users can select a custom size, float and provide a caption for the resulting image.

Installation

  • <translate> [[<tvar name=2>Special:ExtensionDistributor/RandomImage/de-formal</tvar>|Download]] and move the extracted <tvar name=name>RandomImage/de-formal</tvar> folder to your <tvar name=ext>extensions/</tvar> directory.</translate>
    <translate> Developers and code contributors should install the extension [[<tvar name=git>Special:MyLanguage/Download from Git</tvar>|from Git]] instead, using:</translate>cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/RandomImage%2Fde-formal
  • <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
    wfLoadExtension( 'RandomImage/de-formal' );
    
  • File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>

Usage

The tag can be used in two forms:

‎<randomimage />
Produces an image using an automatic caption (see below)
‎<randomimage>...‎</randomimage>
Produces an image with a preset caption (text inside the tags)

The tag also supports the following attributes:

size
Set the image width (default is the user's thumbnail width)
float
Float the image; valid values are left, center and right
choices
Confines image selection to a pipe-delimited list of images
For example
<randomimage size="100" float="left" choices="Apple.jpg|Pear.jpg" />

Caption

If no caption is specified, one will be pulled, if possible, from the image description page.

If the description page contains text wrapped in ‎<randomcaption>...‎</randomcaption> tags, then this will be used as the caption. The tags are ignored during normal page views. Otherwise, the first paragraph of the page text will be used as the caption.

Selection

On wikis where non-images are uploaded (e.g. sound and video files, or documents, etc.), the extension might select a non-image file. There are few performance-efficient means of limiting those files selected.

If $wgRandomImageStrict is switched on, a more complex database query will be performed, with a greater performance cost, which will ensure only images with an image major MIME type are selected.

By default, this option has the same value as $wgMiserMode. You may wish to switch it off if all of the content on your wiki has an appropriate renderer.

Caching

By default, the output is cached in the regular parser cache. This can be advantageous on larger sites which need to use caching to reduce the effects of load, however, it means that content is not 100% dynamic.

To disable the parser cache on pages which use the ‎<randomimage> tag, set $wgRandomImageNoCache = true; in LocalSettings.php (after the call to include the extension file). This will affect all users, and might incur additional overhead on page views.

Siehe auch