Ver Mensaje Individual
  #3 (permalink)  
Antiguo 30/06/2004, 13:38
Avatar de yeta
yeta
 
Fecha de Ingreso: enero-2004
Mensajes: 148
Antigüedad: 20 años, 3 meses
Puntos: 0
lo siento no entendi lo que querias decirme...
te pongo todo el codigo, en el que esta incluido lo de la paginacion
(todo el script q hace el album no se compone solo de esto eh!!)
Código PHP:
<?php
function showImg($aPath$aFn$aThisPage)
{
  global 
$thumbwidth$showfilename;

  
$fullpath $aPath.$aFn;

  
// width and height
  
$imgsize GetImageSize($fullpath);
  
$twidth $thumbwidth;
  
$theight $imgsize[1] / ($imgsize[0]/$twidth);

  
// Thumbnails
  
echo "<td>";
  echo 
"<center><a href=$fullpath target=_blank><img border=\"0\" width=\"$twidth\" height=\"$theight\" src=\"create.php?image=$fullpath&w=$twidth\"></img></a></center>";
  if(
$showfilename) {
    
$l strlen($aFn) - 4;
    echo 
"<br><center>".substr($aFn0$l)."</center>";
  }
  echo 
"</td>";

}

function 
showDir($aPath$aFn)
{
  
$fullpath $aPath.$aFn;
  
$imgsize GetImageSize("folder.gif");
  echo 
"<td>";
  echo 
"<center><a href=\"fotos1.php?path=$fullpath/\"><img border=\"0\" width=\"$imgsize[0]\" height=\"$imgsize[1]\" src=\"folder.gif\"></img></a></center>";
  echo 
"<br><center>$aFn</center>";
  echo 
"</td>";

}

function 
showImgRow($aPath$aFiles$aIsDir$aThisPage$aStart$aEnd)
{
  echo 
"<tr>";
  for(
$i=$aStart$i<$aEnd$i++) {
    if(
$aIsDir[$i]) {
      
showDir($aPath$aFiles[$i]);
    } else {
      
showImg($aPath$aFiles[$i], $aThisPage);
    }
  }
  echo 
"</tr>";
}

function 
showImgTable($aPath$aFiles$aIsDir$aThisPage,
    
$aNumCols$aNumRows)
{
  
$numPerPage $aNumRows $aNumCols;
  
$totalFiles count($aFiles);
  
$start $aThisPage $numPerPage;
  
$end $start $numPerPage;
  
$end min($end$totalFiles);

  echo 
"<center>";
  echo 
"<table border=\"0\" cellspacing=\"10\" cellpadding=\"0\">";

  while(
$start $end) {
    
$e min($start $aNumCols$end);
    
showImgRow($aPath$aFiles$aIsDir$aThisPage$start$e);
    
$start += $aNumCols;
  }

  echo 
"</table>";
  echo 
"</center>";
}

function 
showPageLinks($aPath$aNumFiles$aThisPage$aImg$aNumCols$aNumRows)
{
  
$numPerPage $aNumCols $aNumRows;
  
$numPages ceil($aNumFiles $numPerPage);

  
/*
   * reverse finding '/' start from the second last char
   * since the last char must be '/'
   */
  
$pdir "";
  
$plen strlen($aPath);
  for(
$j=$plen-2$j>0$j--) {
    if(
$aPath[$j] == '/') {
      
$pdir substr($aPath0$j+1);
      break;
    }
  }

  echo 
"<br><center>";
  echo 
"<table border=\"0\" cellspacing=\"10\" cellpadding=\"0\">";
  echo 
"<tr>";
  if(
$aImg) {
    
// Showing big image
    
echo "<td><a href=\"fotos1.php?path=$aPath&page=$aThisPage\"> Go Back </a></td>";
  } else {
    
// show the up link
    
if($pdir != "") {
      echo 
"<td><a href=\"fotos1.php?path=$pdir\">UP</a></td>";
    }
    
// show the page links
    
if($numPages == 0) {
      echo 
"<td>No Images</td>";
    } else {
      
// show only 10 pages
      
$minp 0;
      
$maxp 10;
      if(
$numPages 10) {
        
$minp floor($aThisPage/10) * 10;
        
$maxp ceil(($aThisPage+1)/10) * 10;
      }
      
$maxp min($maxp$numPages);


      
// show the prev link
      
if($minp >= 10) {
        
$prevp $minp 1;
        echo 
"<td><a href=\"fotos1.php?path=$aPath&page=$prevp\">&lt;</a></td>";
      }

      
// show page no(s)
      
for($i=$minp$i<$maxp$i++) {
        
$p $i 1;
        if(
$aThisPage == $i) {
          echo 
"<td><b>$p</b></td>";
        } else {
          echo 
"<td><a href=\"fotos1.php?path=$aPath&page=$i\">$p</a></td>";
        }
      }

      
// show the next link
      
if($maxp $numPages) {
        
$nextp $maxp;
        echo 
"<td><a href=\"fotos1.php?path=$aPath&page=$nextp\">&gt;</a></td>";
      }
    }
  }
  echo 
"</tr>";
  echo 
"</table>";
  echo 
"</center>";
}


function 
readFiles($aPath)
{

  global 
$files$isDir;
  global 
$sortbyname;
  
$files = array();
  
$isDir = array();
  
$confdir "imgconfig";

  
$dir_handle = @opendir($aPath) or die("Unable to open $aPath");

  while(
$file readdir($dir_handle)) {
    
$fullpath $aPath.$file;

    if(
is_dir($fullpath)) {
      if(
$file != '.' && $file != '..' && $file != $confdir) {
        
$files[] = $file;
        
$isDir[] = true;
      }
    } else {
      
$ext substr($file, -4);
      
//if($file[0] != '.' && ($ext == '.jpg' || $ext == '.gif')) {
      
if($file[0] != '.' && (strtolower($ext) == '.jpg')) {
        
$files[] = $file;
        
$isDir[] = false;
      }
    }
    if(
$sortbyname) {
      
sort($files);
    }
  }

  
closedir($dir_handle);
}

function 
adjustPath($aPath)
{
  
$ret $aPath;
  if(!
$ret)
    
$ret "./";
  if(
substr($ret, -1) != "/")
  
$ret $ret.'/';

  
// reset to home, if illegal access
  
if(substr($ret01) != '.' || strstr($ret"..")) {
    
$ret'./';
  }

  return 
$ret;
}
?>
muchas gracias