Photo Gallery

Selection

Seleccione Galeria a desplegar"; //echo '

Photo Gallery: '.$title.'

'; // =============================== GALLERY FUNCTIONS ================================ //-------------------------------- Directory Navigation ----------------------------- function dir_list($dir) // gets the list of directories in the current folder { global $subdir; $rootname = str_replace("_", " ", $subdir['0']); // name of the root photo gallery $dlist = array(); if ($hdir = opendir('./'.$dir)) { while ($obj = readdir($hdir)) { if (((preg_match("/^\./",$obj)==0) && (!eregi('^(.*).[php]$', $obj))) && is_dir($dir.$obj)) //if(is_dir($dir.$obj)) if ($obj <> 'js' && $obj <> 'css' && $obj <> 'images') //not includ folder css, images, js $dlist[] = $obj; } closedir($hdir); } else die('Cannot list files for ' . $dir. '
Cookies Policy
'); asort($dlist); echo "
\n
\n"; } //---------------------------------------Page Navigation ----------------------------- function pagenav() // Writes the numbe rof thumbs, remaining pages, next and prev links { global $page, $pg, $thumb, $dd, $limit, $numtotal, $numremain; $page = 0; if(!$pg) $pg = 1; echo ""; } //------------------------------------- Get image file size ---------------------------------- function getfilesize($size) // gets file size for each image { $units = array(' B', ' KB', ' MB', ' GB', ' TB'); for ($i = 0; $size > 1024; $i++) { $size /= 1024; } return round($size, 2).$units[$i]; } //--------------------------------------Descrption--------------------------------------------- function description($valor,$dir){ $ruta = $dir."description.txt"; if (file_exists("$ruta")) { $gestor = fopen("$ruta","r"); while ($info_descrizione = fscanf($gestor, "%[ -~]\t%[ -~]\n")) { list ($cod, $descri) = $info_descrizione; if ($cod == $valor) return($descri); } fclose($gestor); } } //====================================== END FUNCTIONS ========================================= //------------ Set which folder we are viewing if($_GET['d']) // d variable is in URL string, used for navigating subdirectories { $d = $_GET['d'].'/'; $dd = 'd='.$_GET['d'].'&'; // for use in passing to URL strings $current_dir .= $d; } opendir($current_dir); // open the dir to browse for images if ($show_folders) dir_list($current_dir); // write out the directory navigation (folder list) //----------- Create list of Images $list = array(); if ($dir = opendir('./'.$current_dir)) { while ($file = readdir($dir)) { //if((is_file($file)) && ((!eregi('^(.*).[php]$', $file)) && (!eregi('^(\.htaccess)$', $file)))) //if((eregi('^(.*).[jpg]$', $file)) && (!eregi('^(.*).[php]$', $file))) //if (eregi('^(([:alnum:])*)\.((j|J)(p|P)(g|G)))$', $file)) if (eregi('.jpg', $file)) //If file is a JPG $list[] = $file; if (eregi('.gif', $file)) //If file is a JPG $list[] = $file; if (eregi('.png', $file)) //If file is a JPG $list[] = $file; } closedir($dir); } asort($list); // sort alpha $numtotal = count($list); //total number of thumbs if ($thumb) { $s = 0; while($s < $thumb) { array_shift($list); $s++; } } $numremain = count($list); // total remaining thumbs in the array (folder) if ($_GET['d']) { pagenav(); //page links at top of gallery } //--------- Create Thumbnails and Gallery echo "
"; pagenav(); // Paginado Inferior ?>
Cookies Policy