Ver Mensaje Individual
  #5 (permalink)  
Antiguo 13/03/2008, 09:38
Avatar de rogertm
rogertm
Mod->Cuba
 
Fecha de Ingreso: julio-2005
Ubicación: /home/Cuba/Habana/rogertm/
Mensajes: 2.922
Antigüedad: 21 años, 3 meses
Puntos: 638
Re: gererar tabla para imagenes

yo otra vez, me di cuenta de que tengo el while mal puesto o me sobra, si lo quito me genera bien la tabla, pero no termina el bucle.... por otro lado, no se que hacer con la variable $foto, ya intente de todo:
Código PHP:
<?php
// leer imagenes en el diractorio fotos
$dir = "fotos/";
$explorar = scandir($dir);
$totalFotos = count($explorar);
$total = 0;
for (
$k = 0; $k<=$totalFotos; $k++) {
    if (
$explorar[$k] != "." && $explorar[$k] != ".." && $explorar[$k] != "index.php") {
    
$total++;
    }    
}

$list_ignore = array('.','..','index.php');
if(
$getdir = opendir($dir)){
    echo 
"<table border='1'>";
    
$col = 5;
//    $foto = readdir($getdir);
//    while(($foto = readdir($getdir)) !== false){
        
for($i = 1; $row = $total; $i++){
            
$resto = ($i % $col);
            if(
$resto == 1){echo "<tr>";}
            echo 
"<td colspan='$col'>";
            if(!
in_array($foto, $list_ignore)){
                echo 
"Nombre: $foto: Tipo: ". filetype ($dir . $foto) . "<br>";
                echo 
"<img src='$dir$foto'>";
            }
            echo 
"</td>";
            if(
$resto == 0){echo "</tr>";}            
        }
        if(
$resto <> 0){
            
$ajust = $col - $resto;
            for(
$j = 0; $j < $ajust; $j++) {echo "<td>&nbsp;</td>";}
            echo 
"</tr>";
        }                    
//    }
    
echo "</table>";
    
closedir($getdir);
}
?>
que estoy haciendo mal??? que me falta??? que me sobra???

__________________
Friki y Blogger por Cuenta Propia:213
Twenty'em: Theming is Prose