This Droplet creates a random image tag from a subdirectory of your Media folder.
$folder=opendir(WB_PATH.MEDIA_DIRECTORY.'/'.$dir.'/.');
$names = array();
while ($file = readdir($folder)) {
$ext=strtolower(substr($file,-4));
if ($ext==".jpg"||$ext==".gif"||$ext==".png"){
$names[count($names)] = $file;
}
}
closedir($folder);
shuffle($names);
$image=$names[0];
$name=substr($image,0,-4);
return '<img src="'.WB_URL.MEDIA_DIRECTORY.'/'.$dir.'/'.$image.'" alt="'.$name.'" width="'.$width.'" height="'.$height.'"/>';