Ver Mensaje Individual
  #11 (permalink)  
Antiguo 13/03/2008, 12:39
andersfriden
 
Fecha de Ingreso: julio-2006
Mensajes: 70
Antigüedad: 17 años, 10 meses
Puntos: 0
Re: gererar tabla para imagenes

Prueba así

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;
        
$i 0;
        while((
$foto readdir($getdir)) !== false
        {
                
$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>";
            }
            
$i++;
        }
        echo 
"</table>";
        
closedir($getdir);
    }
?>