Hi,
I have a function that reads jpg files (thumbnails)
from a directory and puts all the files names into an
array...I want to sort that array by the filename,
problem is, I dont know if filenames will be pure
numeric (eg 001.jpg,002.jpg) or alpha-numeric
(asdf001,asdf002)

It HAS to be sequential from small to big (eg: 0-10)
as I am making static html pages from them further
down the program.

Looking in the manual I have tried sort() without any
luck, then looking further I found natcasesort() which
would be perfect for my needs right now, but cant get
it to work :-( 

Below is the function (its not big)

*********** Start function ********************

function directory($dir,$filters){
        $handle=opendir($dir);
        $files=array();
        if ($filters == "all"){while(($file =
readdir($handle))!==false){$files[] = $file;}}
        if ($filters != "all"){
                $filters=explode(",",$filters);
                while (($file = readdir($handle))!==false) {
                        for ($f=0;$f<sizeof($filters);$f++):
                                $system=explode(".",$file);
                                if ($system[1] == $filters[$f]){$files[] = $file;}
                        endfor;
                }
        }
        closedir($handle);
        return $files;
}




$pics=directory("pics","jpg,JPG,JPEG,jpeg,png,PNG");

*********** End function ********************

I have tried putting natcasesort() in many places but
not working....

Thanks in advance.
-Mag

=====
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)


                
__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to