note 26247 added to function.readdir
| From: | me at rack1 dot php dot net | Date: | Wed, 23 Oct 2002 22:12:53 +0000 |
| Subject: | note 26247 added to function.readdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-38481@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);
?>
--
http://www.php.net/manual/en/function.readdir.php
http://master.php.net/manage/user-notes.php?action=edit+26247
http://master.php.net/manage/user-notes.php?action=delete+26247
http://master.php.net/manage/user-notes.php?action=reject+26247