Extension:RandomImage

The RandomImage extension adds a  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.

Usage
The tag can be used in two forms:


 * Produces an image using an automatic caption (see 1>#Caption|below)
 * Produces an image using an automatic caption (see 1>#Caption|below)


 * 
 * Produces an image with a preset caption (text inside the tags)

The tag also supports the following attributes:


 * Set the image width (default is the user's thumbnail width)
 * Set the image width (default is the user's thumbnail width)


 * Float the image; valid values are  left ,  center  and  right 
 * Float the image; valid values are  left , <tvar|2> center </> and <tvar|3> right </>


 * Confines image selection to a pipe-delimited list of images
 * Confines image selection to a pipe-delimited list of images


 * For example

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 <tvar|1><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 <tvar|1> </> 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 <tvar|1> </>. 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 <tvar|1></> tag, set <tvar|2> </> in <tvar|3> </> (after the call to include the extension file). This will affect all users, and might incur additional overhead on page views.