1. Happy New Year Michael!
2. Testpage for this task is this.
#removed_broken_link
Thanks for your reply, used the code as above and used also your default soultion as : <img src="../foto/twg/image.php?twg_album=2006/Rock%20City+HLR&twg_random=1&twg_type=random&twg_random_size=200">
<img src="../foto/twg/image.php?twg_album=2006/<?php
function containsJpeg($dir)
{
$retval = false;
if (is_dir($dir))
{
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false)
{
if($file != "." && $file != "..")
{
//if(endswith )
if(ereg("jpg$", $file))
{
$retval = true;
break;
}
}
}
closedir($dh);
}
}
return $retval;
}
$galleryBasePath = "../foto/twg/pictures/2006/";
$dir_handle = @opendir($galleryBasePath) or die("Unable to open $path");
$folders = "";
while ($file = readdir($dir_handle))
{
$isdir = is_dir($galleryBasePath . $file);
if($file != "." && $file != ".." && $file != "index.php" )
{
if($isdir)
{
if(containsJpeg($galleryBasePath . $file))
{
$folders .= urlencode($file) . "|";
}
}
}
}
closedir($dir_handle);
$folders = rtrim($folders,"|");
echo $folders;
?>&twg_random=1&twg_type=random&twg_random_size=200" border="0">
END of code.
Thanxs for your effort!
/Steffo