Hej
Lavede nedenstående script for nyligt - viser alle billeder i mappen og undermapper.
<?php
$content = "";
$DirArray = array();
$UrlArray = array();
$TimeStampArray = array();
$initdir = dirname($SCRIPT_FILENAME);
array_push($DirArray, $initdir);
while ($dir = array_pop($DirArray)) {
$d = opendir($dir);
while ($file = readdir($d)) {
if (ereg('^(\.|\.\.)$',$file)) {
// never mind
} elseif (is_dir("$dir/$file")) {
array_push($DirArray,"$dir/$file");
} elseif (is_file("$dir/$file")) {
if (strstr(strtolower("$dir/$file"), ".gif") or strstr(strtolower("$dir/$file"), ".jpg")) {
$basedir = substr(dirname($PHP_SELF),1).substr($dir, strlen($initdir))."/";
$Url = "
http://".$SERVER_NAME."/".$basedir.$file; array_push($UrlArray, $Url);
array_push($TimeStampArray, strftime("%D - %T", filemtime("$dir/$file")));
}
}
}
}
$content .= "<html><body><table border='1'>\n";
for ($n = 0 ; $n < sizeof($UrlArray) ; $n++) {
$content .= "<tr><td>\n";
$content .= "<a href='" . $UrlArray[$n] . "' target='blank'>\n";
$content .= "<img src='" . $UrlArray[$n] . "' height='100' alt='Klik for at se i fuld størrelse' border='0'>\n";
$content .= "</a></td><td>\n";
$content .= "<p><b>Filnavn:</b><br><nobr> " . $UrlArray[$n] . "</nobr></p>\n";
$content .= "<p><b>Timestamp:</b><br><nobr> " . $TimeStampArray[$n] . "</nobr></p>\n";
$content .= "</td></tr>\n";
}
$content .= "</table></body></html>\n";
echo $content;
?>