Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/07/2006, 16:11
eximer
 
Fecha de Ingreso: diciembre-2004
Mensajes: 103
Antigüedad: 19 años, 4 meses
Puntos: 0
Como aplicar array_reverse

Hola gente:
Tengo el siguiente problema, estoy haciendo una sencillisima galeria de imagenes, que las subo con uploading a dos directorios una con tamaño normal y otra una copia mas chica.
Para visualizar la galeria dispongo el codigo que pongo a continuacion que muestra los elementos de la carpeta "thumbs" y lo que necesitaria es ayuda para que en vez de que me muestra al principio la imagen mas vieja que subi, me muestra la mas nueva, creo que es con esto de array_reverse pero no se donde o como aplicarlo. Dejo el codigo y agradezco desde ya.

Código:
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<?

// CONFIGURATION

        $cols = 5; // columns number
        $table_bg_color = "black";  // table background color
        $table_border = "0";  // table border size
        $table_width = "";  // table width

// DO NOT EDIT BELOW

        $i =1;
        $files = array ();
        $myDirectory = opendir("imgs/thumbs");
        echo "<table width='$table_width' bgcolor = '$table_bg_color' border ='$table_border' cellpadding='5' cellspacing='0'><tr>";
        while ($file = readdir($myDirectory)) {

        if (($file != ".") && ($file != "..") && ($file != "index.php") && !(is_dir("imgs/$file")) )
        {
    $files[] = $file;
        if (is_int($i / $cols)) {
        list($width, $height) = getimagesize("imgs/$file");
        echo "<td align='center'>";
        ?> <a href="#" onClick="MyWindow=window.open('viewer.php?file=<?php echo $file;?>','MyWindow','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,width=<?php echo "$width";?>,height=<?php echo "$height";?>,left=20,top=20'); return false;"> 
<?
        echo "<img src='imgs/thumbs/$file' border='0'></a>";
        echo "</td></tr><tr>";
        }
        else
        {
        list($width, $height, $type, $attr) = getimagesize("imgs/$file");
        echo "<td align='center'>";
        ?> </a><a href="#" onClick="MyWindow=window.open('viewer.php?file=<?php echo $file;?>','MyWindow','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,width=<?php echo "$width";?>,height=<?php echo "$height";?>,left=20,top=20'); return false;"> 
<?
        echo "<img src='imgs/thumbs/$file' border='0'></a>";
        echo "</td>";
        }
        $i++;
        }
        }
        echo "</tr></table>";
        closedir($myDirectory);



                ?> </a> 
</body>
</html>