Well, I have solved this one with the help of a friend. Here's my code, maybe you include it in the nightly build. We have tried to optimize it to use as less memory ass possible.
`
/**
* Puts up random image thumbs from the gallery
*
* @param int $number how many images
* @param string $class optional class
* @param string $option what you want selected: all for all images, album for selected ones from an album
* @param string $rootAlbum optional album from which to get the images
* @param integer $width the width/cropwidth of the thumb if crop=true else $width is longest size.
* @param integer $height the height/cropheight of the thumb if crop=true else not used
* @param bool $crop 'true' (default) if the thumb should be cropped, 'false' if not
*/
/*
* Helper function - checks if getRandomImages has returned a previosly printed image
*/
function checkSameImage($randomImagesArray,$currentRandomImageWebPath){
foreach($randomImagesArray as $value){
if($value == $currentRandomImageWebPath){
return false;
}
}
return true;
}
function printRandomImages($number=5, $class=null, $option='all', $rootAlbum='',$width=100,$height=100,$crop=true) {
if (!is_null($class)) {
$class = ' class="' . $class . '"';
}
echo "<ul".$class.">";
$rand_img_array=array();
for ($i=1; $i<=$number; $i++) {
echo "
[*]\n";
switch($option) {
case "all":
$randomImage = getRandomImages(); break;
case "album":
$randomImage = getRandomImagesAlbum($rootAlbum); break;
}
if (is_object($randomImage) && $randomImage->exists && checkSameImage($rand_img_array,$randomImage->webpath) == true) {
array_push($rand_img_array,$randomImage->webpath);
$randomImageURL = htmlspecialchars(getURL($randomImage));
echo 'getTitle())) . '">';
if($crop) {
echo "<img src=\"".htmlspecialchars($randomImage->getCustomImage(NULL, $width, $height, $width, $height, NULL, NULL, TRUE))."\" alt=\"" . html_encode($randomImage->getTitle()) . "\" />\n";
} else {
echo "<img src=\"".htmlspecialchars($randomImage->getCustomImage($width, NULL, NULL, NULL, NULL, NULL, NULL, TRUE))."\" alt=\"" . html_encode($randomImage->getTitle()) . "\" />\n";
}
echo "";
}else{
$i--;
}
echo "
\n";
}
echo "";
}
`