<?php
$max=20;
$end="jpg"; //Endung der Datei
function getFiles($path) {
$result = false;
$dh=opendir($path);
if ($dh) {
while ($file = readdir($dh)) {
if (eregi("(\.gif)|(\.jpg)|(\.jpeg)|(\.png)$",$file)) {
$result[] = $file;
}
}
closedir($dh);
}
return $result;
}
require_once('./zufallthumbnail.php');
$imgpath = "./screens/total/";
$errors = false;
$files = getFiles($imgpath);
if (is_array($files)) {
$thumbnail = new thumbnail;
$thumbnail->path_org = $imgpath;
foreach($files as $file) {
if ($thumbnail->getThumb($file)) {
//printf ("<a href=\"javascript:void(0);\" onclick=\"window.open('%s', 'window".md5(microtime())."', 'toolbars=0, scrollbars=0, location=0, statusbars=0, menubars=0, resizable=1, width=".$w.", height=".$h.", left = 20, top = 20');\"><img src=\"%s\" border=\"0\" ></a> ",
$z=array();
$c=0;
$ver=$thumbnail->path_org; //Bilderverzeichniss
$ver1=$thumbnail->path_thumb; //Bilderverzeichniss
// Fünf Bilder raussuchen, nicht doppelt
while ($c<1)
{
mt_srand((double)microtime()*1000000);
$rnd=mt_rand(1,$max);
if (!isset($z[$rnd])) { $z[$rnd]=1; $c++; }
}
// Anzeige der Bilder
$c=0;
for ($i=1; $i<($max+1); $i++)
{
if (isset($z[$i]))
{
echo "<a href=\"javascript:void(0);\" onclick=\"window.open('$ver$file.$end', 'window".md5(microtime())."', 'toolbars=0, scrollbars=0, location=0, statusbars=0, menubars=0, resizable=1, width=".$w.", height=".$h.", left = 20, top = 20');\"><img src=\"$ver1$file.$end\" width=\"102\" height=\"89\" border=\"0\" alt=\"Picture of the Moment\"></a> ";
$c++;
}
if ($c==1)
{
$c++;
}
}
}
else
{
$errors[$file] = $thumbnail->error['msg'];
}
}
if (is_array($errors)) {
foreach($errors as $key=>$val) {
print ('<hr>Fehler<br>');
printf('%s : %s', $key, $val);
}
}
} else {
print ("No Files found.");
}
?>