$error

\n\n"; $print_footer(); exit(); } // get image size function function gallery_imgsize($image) { $size = GetImageSize($image); return "width=$size[0] height=$size[1]"; } // check for directories if(!is_dir($thumbs_dir)) { imgerror('Directory "'.$thumbs_dir.'" does not exist.'); } if(!is_dir($full_dir)) { imgerror('Directory "'.$full_dir.'" does not exist.'); } // get contents of $thumbs_dir $dir = @opendir($thumbs_dir) or imgerror('Can\'t open ' . $thumbs_dir . ' directory'); $thumbs = array(); while($thumb = readdir($dir)) { if(preg_match('/(jpg$|jpeg$|gif$|tif$|bmp$|png$)/', $thumb)) array_push($thumbs, $thumb); } rsort($thumbs); // lowest displayed image in the array // use http_get_vars incase register_globals is off in php.ini if (!isset($HTTP_GET_VARS['i'])) { $i = 0; } else { $i = $HTTP_GET_VARS['i']; } // check to see if all thumbs are meant to be displayed on one page if ($max_thumbs == 0) { $max_thumbs = sizeof($thumbs); $mt_check = 1; } else { $mt_check = 0; } // thumbnail view if (is_numeric($i)) { // check to see which thumbnail to start with if (!$mt_check && $i > 0) { $start = $max_thumbs * ($i - 1); } else { $start = 0; } // are they looking for thumbs pages that don't exist? if ($start > sizeof($thumbs)) { print 'index' . "\n\n"; imgerror('Sorry, there are no images to display on this page'); } ?>    
= sizeof($thumbs)) { break; } // print new row after predefined number of thumbnails if(($count % $cols == 1) && $count != 1 && $cols > 1) { print ''; } else if ($cols == 1) { print ''; } // open cell print '' . "\n"; $count++; } ?>
'; // insert thumb print ''; // image title if($thumb_title) { $title = explode(".", str_replace("_", " ", ucfirst($thumbs[$start]))); print "\n" . $title[0]; } // close cell print '
"; // how many total thumbs pages, including a "remainder" page if needed $pages = ceil(sizeof($thumbs) / $max_thumbs); for ($count = 1; $count <= $pages; $count++) { if ($count == 1) { if ($count == $i || $i == 0) { print $count; } else { print "$count"; } } else { if ($count == $i) { print " | $count"; } else { print " | $count"; } } } print '

'; } } // single image view else if (file_exists("$full_dir/$i")) { // find where it is in the array $key = array_search($i, $thumbs); if (is_null($key)) { $key = -1; } ?>
 
 
\n\n"; // caption (optional) if (file_exists("$captions_dir/$i.$cext")) { print '

'; require("$captions_dir/$i.$cext"); print '

'; } // navigation print '

'; // previous if($key >= 1) { print '« previous | '; } else { print '« previous | '; } // index print 'main'; // random if ($showrand != 0) { $random = array_rand($thumbs, 2); print ' | random'; } // next if($key != (sizeof($thumbs) - 1)) { print ' | next »'; } else { print ' | next »'; } print "

\n\n"; if($full_title) { $title = explode(".", str_replace("_", " ", ucfirst($i))); print "
$title[0]
\n\n"; } // numerically show what image it is in the series; hide this if image isn't in the series if ($key >= 0) { // add 1 so that the first image is image 1 in the series, not 0 print '
' . ($key + 1) . ' of ' . sizeof($thumbs) . "

\n\n"; } } // no image found else { ?>

index