The {random_image} TAG fetches random filesnames from a directory.
This feature can be useful for example when creating an image slider.
The name of the template variable the array of filenames will be assigned to.
The directory to load files from..
A comma separated list of file extensions which that should be used when searching files. Defaults to “gif,png,jpg,jpeg”.
Amount of maximum files that should be returned. Defaults to 1. If less files were found, all found will be returned.
This example shows a simple example, where we fetch 5 images from the folder /public/cid1/slider/:
<html> <head> <title>{$MENU->getName()}</title> </head> <body> <ul> {directory name="stylesheets" assign="imgDir"} {random_image amount="5" dir="$imgDir/slider/" assign="images"} {foreach from=$images item="imgFile"} <li><img src="{directory}slider/{$imgFile}" height="110" alt="" /></li> {/foreach} </ul> </body> </html>