Random Mini thumbnails

Mini_Rand:T./*"One random picture"
One random picture

Reload this page to see how the thumbnail changes.

If you want to display more than one random thumbnail, write the number before the filelist:

Mini_Rand:3,*.jpg for 3 random thumbnails among all attached *.jpg
mini_Rand:T.T/3,*"Three random pictures"
Three random picturesThree random picturesThree random pictures

Note that in the above triple example the pictures are attached to another page (T.T) and the number of thumbnails, 3, is after the slash T.T/.


Random thumbnails are possible from version 20090509. To enable this feature, add to config.php the following function:

function uMini_Rand($a){ # random slice
  foreach($a as $k=>$v)break;$cnt=is_numeric($v)?array_shift($a):1;shuffle($a);
  $b=array();for($i=0;$i<min($cnt,count($a));$i++)$b[$a[$i]]=$a[$i];return $b;

Now, to display one random thumbnail from a set of pictures, write in the page:


The command (filelist, captions...) is the same as with Mini: except that the prefix is "Mini_Rand:". Use lowercase mini_Rand: to not link to the originals (as usual).


Please note that Random thumbnails will not be random if you enable cache.

If you have enabled the cache for the whole site in config.php, you can disable the cache for an individual page with random thumbnails, by creating a file local/Group.Page.php conaining:

  $Mini['EnableCache'] = 0;

See also