How do directories organize themselves?

Hello,

I am using php to open and read a directory and create a list of images. It works fine, for the most part.

Issue one:
The images aren’t returned in alphabetical order.

Issue Two:
IE (tested it only on 9 so far) doesn’t return the last image.

Does anyone have insight on either or both of these two issues?

Thanks,
–EthanG

Can you post the script you’re using? Hard for us to diagnose the problem “blind”.

Good call.

Here is the main chunk that opens and reads the directory (somewhat edited down for readability):
[php]
// Open specified directory
$openDir = opendir($dir); // Location of images
// Loop directory contents (should only add images)
while($file = readdir($openDir)){
if ($file != “.” && $file != “…”) echo($file); // Will echo image01.jpg, image02.jpg and so on, but ONLY on local host.
}
[/php]

Any thoughts or suggestions?
Thanks for the help!

Here is the full script, if need be.

[php]<?php
// Image directory
$dir = ‘images/gallery/full’;
// An array to hold our returned images
$ary = array();
// The variable to hold our compiled html
$body = “”;

// Gallery
///////////////////////////////////////////////////////////////////////////
// Define the gallery div

$body .= ‘

’;
// Open specified directory
$openDir = opendir($dir);
// Loop directory contents (should only add images)
while($file = readdir($openDir)){
if ($file != “.” && $file != “…”) $body .= ‘' . $file .'’;
} // Close the gallery tag
$body .= ‘
’;
// Echo out the entire home page
echo($body);
?>[/php]