Topic: Back to order by filename

Years ago I managed to change the script and have AV sort my pictures randomly. Now I want them to be sorted by filename again, but can't figure out how.

This is the gallery.php I use

<gallery frameColor="0xFFFFFF" frameWidth="0" imagePadding="00" displayTime="5" enableRightClickOpen="false">
<?php
    $fotos = array();
    //open dir 
    //$dir = "/var/www/blablabla/";
    $dir = "images/";
    
    if (is_dir($dir)) {
    if ($dh = opendir($dir)) {
        while (($file = readdir($dh)) !== false) {
            if($file != '.' && $file != '..'){
             list($width, $height, $type, $attr) = getimagesize($dir.$file);
             
             $tmp = array( 
                     url => 'http://blablabla/'.$file,
                     caption => '',
                     width => '900',
                     height => '600'
                     );
             $fotos[] = $tmp;
            }
                   }
        closedir($dh);
    }
}
shuffle($fotos);        
         foreach($fotos as $foto){
        ?>
        <image>
               <url><?=$foto['url']?></url>
               <caption><?=$foto['caption']?></caption>
               <width><?=$foto['width']?></width>
               <height><?=$foto['height']?></height>
        </image>
        <?
    }
?>
</gallery>

Just deleting the Shuffle part is not enough, it then sorts them in a way I can not understand.

Thanks!

Last edited by kissyfur (2010-04-08 14:32:31)