note 66336 deleted from function.readdir by tularis

From: Date: Sun, 13 May 2007 19:00:46 +0000
Subject: note 66336 deleted from function.readdir by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-126510@lists.php.net to get a copy of this message
Note Submitter: repley at freemail dot it ---- BugFix of davidstummer at yahoo dot co dot uk listImages() function: <?php function listImages($dirname=".") { $ext = array("jpg", "png", "jpeg", "gif"); $files = array(); if($handle = opendir($dirname)) { while(false !== ($file = readdir($handle))) for($i=0;$i<sizeof($ext);$i++) if(stristr($file, ".".$ext[$i])) //NOT case sensitive: OK with JpeG, JPG, ecc. $files[] = $file; closedir($handle); } return($files); } ?> Thanks to all. Repley

« previous php.notes (#126510) next »