Posted by ZeldorBlat on 04/15/07 14:44
On Apr 15, 8:27 am, Tim Van Wassenhove <t...@users.sourceforge.net>
wrote:
> MZ schreef:
>
> > Unfortunately images are not sorted by filename and I don`t know why.
>
> From:http://www.php.net/readdir
> Returns the filename of the next file from the directory. The filenames
> are returned in the order in which they are stored by the filesystem.
>
> So you still have to add code that sorts the filenames by name..
>
> eg:
>
> $filenames = array();
> while ($filename = readdir($dir)) {
> $filenames[] = $filename;
>
> }
>
> sort($filenames);
>
> foreach($filename in $filenames) {
> echo $filename . '<br/>';
>
> }
>
> --
> Tim Van Wassenhove <url:http://www.timvw.be/>
Alternatively you can use scandir() and specify the sorting_order
parameter:
<http://www.php.net/scandir>
[Back to original message]
|