Ver Mensaje Individual
  #4 (permalink)  
Antiguo 28/07/2005, 06:39
Avatar de The_Dark_Roy
The_Dark_Roy
 
Fecha de Ingreso: enero-2004
Mensajes: 218
Antigüedad: 20 años, 2 meses
Puntos: 0
Código PHP:
<table border="0" cellpadding="0" cellspacing="0" width="100%">
                <tr>
                    <!--este td tiene los margenes del cuerpo-->
                    <td width="10" height="10"></td>
                    <!--este td tiene la columna central del cuerpo-->
                    <td></td>
                    <!--este td tiene la columna derecha del cuerpo-->
                    <td></td>
                </tr>
                <tr>
                    <td></td>
                    <td><img alt="Galerias" border="0" src="img/t_c_galerias.gif" title="Galerias"></td>
                    <td></td>
                </tr>
                <tr>
                    <td colspan="3" height="10"></td>
                </tr>
                <tr>
                    <td></td>
                    <td colspan="2"><a href="?op=3"><img alt="Volver" border="0" src="img/volver.gif" title="Volver"></a></td>
                </tr>
                <tr>
                    <td colspan="3" height="10"></td>
                </tr>
                <tr>
                    <td align="center" colspan="3">
                        <table border="0" bgcolor="#471F10" cellpadding="1" cellspacing="1" width="90%">
                        <?php
                            
require("surire_conexion.php");
                            require(
"funciones.php");
                            if(isset(
$_GET['id_gal'])){
                                
$id_gal=$_GET['id_gal'];
                                
$qry="SELECT nombre,path_galeria,num_img FROM galerias WHERE id='$id_gal'";
                                
$res=mysql_query($qry);
                                if(
mysql_num_rows($res)==1){
                                    
$fila=mysql_fetch_assoc($res);
                                    
$titulo=ucfirst($fila[nombre]);
                                    
$path_galeria=str_replace (".."".",$fila[path_galeria]."/");
                                    
$pt=opendir($path_galeria);
                        
?>
                            <tr>
                                <td align="center" background="img/back_titulo_2.jpg" colspan="4" ><span class="titulo_form"><?php echo "$titulo"?></span></td>
                            </tr>
                            <?php
                                    $status
=1;
                                    
$i=1;
                                    while(
$file=readdir($pt)){
                                        
$arch=split("[.]",$file);        
                                        if(
$arch[1]=="JPG" || $arch[1]=="jpg" || $arch[1]=="GIF" || $arch[1]=="gif" || $arch[1]=="PNG" || $arch[1]=="png"){
                                            
$path=$path_galeria.$file;
                                            
$tam_img=getimagesize($path);
                                            if(
$i%2==0){
                                                
$bg_color="#CAAC8A";
                                            }else{
                                                
$bg_color="#A77A52";
                                            }
                                            if(
$tam_img[0]>$tam_img[1]){
                            
?>
                                <td align="center" bgcolor="<?php echo"$bg_color";?>" height="100" valign="middle" width="150">
                                    <a href="<?php echo "$path"?>" target="_blank">
                                        <img alt="Surire || <?php echo "$titulo";?> | <?php echo "$file"?>" border="0" src="thumnails.php?file=<?php echo "$path";?>" title="Surire || <?php echo "$titulo";?> | <?php echo "$file"?>">
                                    </a>
                                </td>
                            <?php
                                            
}else if($tam_img[0]<$tam_img[1]){
                            
?>
                                <td align="center" bgcolor="<?php echo"$bg_color";?>" height="150" valign="middle" width="150">
                                    <a href="<?php echo "$path"?>" target="_blank">
                                        <img  alt="Surire || <?php echo "$titulo";?> | <?php echo "$file"?>" border="0" src="thumnails.php?file=<?php echo "$path";?>" title="Surire || <?php echo "$titulo";?> | <?php echo "$file"?>">
                                    </a>
                                </td>
                            <?php        
                                            
}
                                            if(
$i%4==0){
                                                echo 
"</tr><tr>";                                                            
                                            }
                                            
$i++;
                                        }
                                    }
                                    
$j=0;
                                    while(
$j<num_td($fila[num_img])){
                                    
$aux=num_td($fila[num_img]);
                                        if(
$bg_color=="#A77A52"){
                                                
$bg_color="#CAAC8A";
                                            }else{
                                                
$bg_color="#A77A52";
                                            }
                            
?>
                                <td bgcolor="<?php echo"$bg_color";?>">&nbsp;</td>
                            <?php
                                    $j
++;
                                    }
                                    echo 
"</tr>";
                            
?>
                        </table>
                        <?php
                                    closedir
($pt);
                                }else{
                        
?>
                        <table>
                            <tr>
                                <td height="10"></td>
                            </tr>
                            <tr>
                                <td class="error">&nbsp;Esta Galeria no existe.&nbsp;</td>
                            </tr>
                        </table>
                        <?php
                                
}
                            }else{
                        
?>
                        <table>
                            <tr>
                                <td height="10"></td>
                            </tr>
                            <tr>
                                <td class="error">&nbsp;Ud a ingresado incorrectamente o Se ha perdido informacion durante el proceso.&nbsp;</td>
                            </tr>
                        </table>
                        <?php
                                
}
                        
?>
                        </td>
                    </tr>
                    </td>
                </tr>
            </table>
echale una mirada a este codigo, ojala te sirva de ayuda lo que hace es leer un directorio y mostrar solo las imagenes, lo unico que tienes que hacer es enviar el id del registro de una galeria donde rescatas el path de la base de datos.
que te ayude.
__________________
ojala te hayas quitado la venda

http://www.surire.cl
http://www.uta.cl