Posted: Wed Jun 11, 2003 9:05 am
I think this all down to the directory that I 'm opening - as with all my problems posted on this forum it is going to come down to the syntax of the directory / folder I am opening...
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
<?
function CheckExt($filename, $ext) {
$passed = FALSE;
$testExt = "\.".$ext."$";
if (eregi($testExt, $filename)) {
$passed = TRUE;
}
return $passed;
}
$exts = array("gif","jpg$|\\.jpeg","png","bmp");
echo "<b>Images in this folder:</b>";
$dir = opendir(".");
$files = readdir($dir);
while (false !== ($files = readdir($dir))) {
foreach ($exts as $value) {
if (CheckExt($files, $value)) {
echo "<img src='$files' >\n";
$count++;
break;}
}
}
echo $count." image(s) found in this directory.\n";
echo "<a href="".$_SERVER["PHP_SELF"]."">Refresh</a>\n";
closedir($dir);
?>