That page wasn't coded by me, im just including a premade script (i'm not all that good with php... i can edit but thats about it)
The css can be viewed (probably not all that well coded)
here
The code of the page is here
and the code for "gallery.php" is below
Code:
<?php
$limit = 10; // number of thumbs to show per page.
$w = 150; // max width of thumbnails.
$h = 150; // max height of thumbnails.
$show_folders = 0; // Set to 1 to show folder list, 0 to turn off
$isize = 1; // Set to 1 to display image filesize
$idim = 1; // Set to 1 to display image dimensions
//============================================
// No further options below here.
if($pg = $_GET['pg'])
{
$thumb = (($pg-1)*$limit);
$i = $thumb;
}
//if($thumb = $_GET['thumb'])
// $i = $thumb;
else
$i = 0;
// get the directory name
$dirlist = dirname($_SERVER['SCRIPT_NAME']);
// split it up
$subdir = explode("/", $dirlist);
// reverse it so directory above images is listed
$subdir = array_reverse($subdir);
// page title name is root dir.
$title = str_replace("_", " ", $subdir['0']);
//$my_uri = "http://" . $_SERVER['HTTP_HOST'] . $HTTP_SERVER_VARS["SCRIPT_NAME"];
if(ereg("\.\.", $_GET['d']))
header ("Location: ?");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Photo Gallery - <? echo $title; ?></title>
<style type="text/css">
body {background-color: #ffffff; text-align: center; font-family: verdana; font-size: 12px; color: #fff;}
h1 {font-size: 16px; margin: 1em; }
#dirnav {height: 16px; position: relative; margin: auto auto 5px auto; clear: both; border-bottom: 1px solid #aaa; text-align: center; padding: 3px; }
#dirnav ul, #dirnav li {margin: auto; padding: 0; list-style-type: none; }
#dirnav li {float: left; text-align: center; }
#dirnav a {display: block; padding: 2px 5px 2px 5px; }
#thumbs {width: 100%; margin: 10px; border: 1px solid black; clear: both; text-align: center; }
p.thumb {width: <? echo $w+18; ?>px; height: <? echo $h+32; ?>px; margin: 1em; padding: 3px; float: left; border: 1px solid #000; font-size: 12px; text-align: center; }
#nav {position: relative; margin: auto; clear: both; border-top: 1px solid #aaa; text-align: center; }
#nav ul, #nav li {margin: auto; padding: 0; list-style-type: none; }
#nav li {float: left; text-align: center; }
#nav li.current a.page {font-weight: bold; color: #ddd; }
#nav a {}
#nav a.page {display: block; padding: 2px 5px 2px 5px; }
#nav a.prev, #nav a.next , #nav .prev, #nav .next {display: block; width: 65px; padding: 2px 5px 2px 5px; }
#nav a:hover { }
a {color: #999; text-decoration: none; }
a:hover, a:active {color: #d0d0d0; }
a img {border: 1px solid #777; }
a:hover img {border: 1px solid #d0d0d0; }
a.page {color: #999; }
</style>
</head>
<?
echo '<h1>Photo Gallery: '.$title.'</h1>';
//-------------------------------- Directory Navigation -----------------------------
function dir_list($dir)
{
global $title;
$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 "<div id='dirnav'><ul>\n<li>Folders:</li>\n";
echo "<li> <a href='?'>$title » </a></li>\n";
$dirtree = explode("/", $_GET['d']); // parse directory tree from passed "d"
if(!$_GET['d'])
array_shift($dirtree); // remove redundant "." directory from tree
foreach ($dirtree as $dirsub)
{
echo "<li> <a href='?d=$dirparent$dirsub'>$dirsub » </a></li>\n";
$dirparent .= $dirsub.'/';
}
foreach ($dlist as $link)
{
echo "<li><a href='?d=$dir$link'>[$link]</a></li>\n";
}
echo "</ul>\n</div>\n";
}
//-------------------------------------Get image file size ----------------------------------
function getfilesize($size)
{
$units = array(' B', ' KB', ' MB', ' GB', ' TB');
for ($i = 0; $size > 1024; $i++) { $size /= 1024; }
return round($size, 2).$units[$i];
}
//-------------------------------------Set which folder we are viewing----------------
if($_GET['d'])
{
$d = $_GET['d'].'/';
$dd = 'd='.$_GET['d'].'&'; // for use in passing to URL strings
$current_dir .= $d;
}
opendir($current_dir);
if ($show_folders)
dir_list($current_dir);
//--------------------------------------- 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
//-------------------------------------- Create Thumbnails and Gallery ------------------
foreach ($list as $pic)
{
$fp = $current_dir.$pic;
if($i < $thumb+$limit)
{
//echo "<p class='thumb'><tt><a href='$current_dir$pic'><img src='tn/$pic' alt='$pic' /><br />$pic</a> - [".getfilesize(filesize($fp))."]</tt></p>\n";
$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 "<p class='thumb'>
<tt>
<a href='$current_dir$pic'><img src='image_resize.php?i=$d$pic&w=$w&h=$h' alt='$pic' /><br />
$name<br /></a>\n";
if($idim)
echo " [$i_width x $i_height]";
if($idim && $isize)
echo " - ";
if ($isize)
echo " [$i_size]";
echo " <br />
</tt>
</p>\n";
$i++;
}
}
//---------------------------------------Page Navigation -----------------------------
$page = 0;
if(!$pg)
$pg = 1;
echo "<div id='nav'>\n<ul>\n";
if($thumb > 0)
echo "<li><a class='prev' href='?".$dd."pg=".($pg-1)."'>« Previous Page</a></li>\n";
else
echo "<li><div class='prev'>« Previous Page</div></li>";
while($page*$limit < $numtotal)
{
$page ++;
unset($cur);
if($page == $pg)
{
$cur = ' class="current"';
}
echo "<li$cur><a class='page' href='?".$dd."pg=$page'>[".($page)."]</a></li>\n";
}
if($numremain > $limit)
echo "<li><a class='next' href='?".$dd."pg=".($pg+1)."'>Next Page »</a></li>\n";
else
echo "<li><div class='next'>Next Page »</div></li>\n";
?>