Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/06/2005, 09:45
luque_finde
 
Fecha de Ingreso: marzo-2004
Mensajes: 53
Antigüedad: 20 años, 1 mes
Puntos: 0
Como ordeno el readdir

Hola gente!!


Tengo el siguiente codigo que genera una photogallery leyendo las imagenes de los directorios q encuentra y quisiera que me mostrara el nombre de los directorios ordenados.

<?php
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ((is_dir($file)) && $file != "." && $file != "..") {
$num = 0;
$path= $file;
$abrir=opendir("$path/");
while ($img=readdir($abrir)){
$x1 = explode(".", "$img");
$x2 = count($x1);
if(($x1[$x2-1] == jpg) || ($x1[$x2-1] == JPG) ){
$num++;
}
if(($x1[$x2-1] == jpg) || ($x1[$x2-1] == JPG)){
$src= "escala.php?id=$img&path=$path";
}else{
$src= "$path/$img";
}
}

$nom_gallery=str_replace("_"," ","$path");
$nom_gallery_ok=strtoupper($nom_gallery);
$nom_gallery_ok2=substr("$nom_gallery_ok",9);
echo "<table width=270 border=0 align=center cellpadding=0 cellspacing=0>
<tr>
<td><table width=95% border=0 align=center cellpadding=0 cellspacing=0>
<tr>
<td width=45%><a href=galeria.php?path=".$path."><img src=".$src." border=0 width=75 height=75></a></td>
<td width=67% class=verdana8white><div align=center><strong>".$nom_gallery_ok2."
<br>
<br>
<font color=#CCCCCC>Fotos:</font></strong><font color=#CCCCCC>".$num."</font></div></td>
</tr>
</table></td>
</tr>
</table>
<br>";


}
}
closedir($handle);
}
?>


Alguna sugerencia?

Gracias. Un saludo.