Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/09/2006, 05:51
eximer
 
Fecha de Ingreso: diciembre-2004
Mensajes: 103
Antigüedad: 19 años, 4 meses
Puntos: 0
Mostrar archivos paginados?

Hola gente:
Tengo un sencillo script de galeria de imagenes, con un archivo subo las imagenes, y con otros dos las muestro.
El script que muestra las imagenes lee todo el contenido de un directorio. Alguien puede darme una mano para que cuando muestre las fotos me pagine por ej hasta 30 archivos o fotos por pagina? ya que se hace muy pesado esperar toda la carga cuando por ejemplo hay 100 fotos.
Dejo el codigo completo
Gracias desde ya.

Código:
<html>
<head>
<title>:: Galeria ::</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
</script>
</head>

<body bgcolor="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellspacing="10" cellpadding="0">
  <tr bgcolor="#333333"> 
    <td><img src="../boton_galeria.gif" width="320" height="30"></td>
  </tr>
  <tr>
    <td><?
$files = array (); 
$myDirectory = opendir("imgs/thumbs"); 
         
while ($file = readdir($myDirectory)) { 

   if (($file != ".") && ($file != "..") && ($file != "index.php") && !(is_dir("imgs/$file")) ){ 

    // aquí los acomulas en el array $files ... 
    $files[] = $file; 
     } 
} 
closedir($myDirectory);
$archivos = array_reverse($files); 
// me deshago de $files (mi array original) .. no lo necesito .. ya lo tengo en $archivos y ordenado como necesito. 
unset($files); 
?> <? 
        $cols = 6; // columns number
        $table_bg_color = "black";  // table background color
        $table_border = "0";  // table border size
        $table_width = "";  // table width
$i =1; 
        echo "<table width='$table_width' bgcolor = '$table_bg_color' border ='$table_border' cellpadding='5' cellspacing='0'><tr>"; 
        foreach ($archivos as $archivo) { 

        if (is_int($i / $cols)) { 
        list($width, $height) = getimagesize("imgs/$archivo"); 
        echo "<td align='center'>"; 
        ?> <a href="#" onClick="MM_openBrWindow('viewer.php?file=<?php echo $archivo;?>','','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/$archivo' border='0'></a>"; 
        echo "</td></tr><tr>"; 
        } 
        else 
        { 
        list($width, $height, $type, $attr) = getimagesize("imgs/$archivo"); 
        echo "<td align='center'>"; 
        ?> </a><a href="#" onClick="MM_openBrWindow('viewer.php?file=<?php echo $archivo;?>','','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/$archivo' border='0'></a>"; 
        echo "</td>"; 
        } 
        $i++; 
        } 
        echo "</tr></table>";
?></a> </td>
  </tr>
</table>
</body>
</html>

Última edición por eximer; 20/09/2006 a las 05:57