based on whether name or dimensions is displayed $pwidth = $w+12; $pheight = $h+12; if($ititle) $pheight +=10; // increase height of thumbnail

element if($isize || $idim) // if displaying dimensions or size of image, increase height of thumbnail

element. $pheight +=10; ?> Photo Gallery - <? echo $title; ?>

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)) $dlist[] = $obj; } closedir($hdir); } else die('Cannot list files for ' . $dir); 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]; } //====================================== 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; } 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) pagenav(); //page links at top of gallery //--------- Create Thumbnails and Gallery echo "
"; foreach ($list as $pic) { $fp = $current_dir.$pic; if($i < $thumb+$limit) { $image = $currentdir.$pic; $i_size = getfilesize(filesize($fp)); $i_area = getimagesize($fp); $i_width = $i_area[0]; $i_height = $i_area[1]; //$i_mtime = date("d F Y ", filemtime($fp)); $name = str_replace('.jpg', '', $pic); echo "

\n"; echo " "; echo " $pic"; if($ititle) echo "
$name"; if ($idate) echo " - ".date("F d", filemtime($current_dir.$pic)); echo "
\n
"; if($idim) echo "$i_width x $i_height"; if($idim && $isize) echo " - "; if ($isize) echo "[$i_size]"; echo "

\n\n"; $i++; } } echo "
"; pagenav(); // page links at bottom of gallery echo "

Photo Gallery by Forge22 Design\n"; echo "

"; ?>