note 23833 deleted from function.readdir by dams
| From: | dams@php.net | Date: | Tue, 30 Jul 2002 00:45:25 +0000 |
| Subject: | note 23833 deleted from function.readdir by dams | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-33937@lists.php.net to get a copy of this message | ||
Here's a simply code snipet to display all images in a folder in HTML
<table border="0" cellpadding="0" cellspacing="0">
<%
$Count = 0;
$PhotosPerLine = 8;
if ($dir = @opendir("/home/gjahnke/htdocs/browns/images")) {
while (($file = readdir($dir)) !== false) {
if ($file != "." and $file != ".." and substr($file,0,1) != "_" )
{
$Count++;
$filetime = filemtime("/home/gjahnke/htdocs/browns/images/$file");
$filetime = date("F j Y h:i:s A", $filetime);
if ($Count == 1) {
print "<tr>";
}
print "<td align=\"center\"><font face=\"Verdana\"
size=\"2\"><b><a href=\"images/$file\">";
print "<img src=\"images/$file\" width=100 height=100>";
print "</a><br>$filetime<br></b></font></td>";
if ($Count == $PhotosPerLine) {
print "</tr>";
$Count = 1;
}
}
}
closedir($dir);
}
%>
</table>