note 26247 deleted from function.readdir by philip
| From: | philip@php.net | Date: | Fri, 08 Nov 2002 01:59:11 +0000 |
| Subject: | note 26247 deleted from function.readdir by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-39124@lists.php.net to get a copy of this message | ||
to show image files in a folder
<?
// Text and stuff..
echo "<b>Images in this folder:</b><br>";
// First we open the directory, this file lays in..
$dir = opendir(".");
$files = readdir($dir);
// Display name and thumbnail
while ($files = readdir($dir)){
if (ereg(".jpg", $files) || ereg(".gif", $files) || ereg(".png",
$files) || ereg(".bmp", $files)) {
echo "<a href=\"$files\"><img src=\"$files\"
border=\"0\" height=\"50\"><br>";
echo "$files</a><br><br>";
// Counts how many pictures, which have been found
$total = $total+1;
}
}
// Show the number of pictures found
echo "$total pictures found in this folder. <a
href=\"$PHP_SELF\">Refresh</a>";
// Close the dir
closedir($dir);
?>