<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Image Galleries</title>
</head>
<body>
<?php
define("IMAGESPATH",'gallery/images');
define("THUMBSPATH",'gallery/thumbs');
define("MAXIMAGESPERROW",5);
define("MAXROWSPERPAGE",4);
define("SHOWPICCOUNT",false);
require("content/directorylist.class.php");
if (SHOWPICCOUNT==true)
{
$images=new directorylist(IMAGESPATH,true);
}
else
{
$images=new directorylist(IMAGESPATH,true,true);
}
if (!empty($_GET['gallery']))
{
if (!empty($_GET['image']))
{
if (SHOWPICCOUNT==false)
{
$images->subdirs[$_GET['gallery']-1]=new directorylist($images->subdirs[$_GET['gallery']-1]->name,true,true);
}
$name=explode("/",$images->subdirs[$_GET['gallery']-1]->name);
$name=$name[count($name)-1];
echo '<a href="index.php?file=photos&gallery='.$_GET['gallery'].'"><b>'.$name.'</b></a>';
echo '<span style="margin-left:100px"><span style="margin-right:5px">';
if ($_GET['image']>1)
{
echo '<a href="index.php?file=photos&gallery='.$_GET['gallery'].'&image='.($_GET['image']-1).'"><</a>';
}
else
{
echo '<';
}
echo '</span><span style="margin-left:5px">';
if ($_GET['image']<count($images->subdirs[$_GET['gallery']-1]->files))
{
echo '<a href="index.php?file=photos&gallery='.$_GET['gallery'].'&image='.($_GET['image']+1).'">></a>';
}
else
{
echo '>';
}
echo '</span></span>';
echo '<a href="index.php?file=photos&">Back to the galleries</a><hr>';
echo '<img src="'.IMAGESPATH.'/'.$name.'/'.$images->subdirs[$_GET['gallery']-1]->files[$_GET['image']-1].'" alt="'.$images->subdirs[$_GET['gallery']-1]->files[$_GET['image']-1].'">';
}
else
{
if (!empty($_GET['page']))
{
$page=$_GET['page'];
}
else
{
$page=1;
}
$name=explode("/",$images->subdirs[$_GET['gallery']-1]->name);
$name=$name[count($name)-1];
echo '<b>'.$name.'</b>';
$thumbs=new directorylist(THUMBSPATH.'/'.$name,true,true);
$pages=ceil(count($thumbs->files)/(MAXIMAGESPERROW*MAXROWSPERPAGE));
echo '<span style="margin-left:100px"><span style="margin-right:5px">';
if ($page>1)
{
echo '<a href="index.php?file=photos&gallery='.$_GET['gallery'].'&page='.($page-1).'"><b> < Previous </b></a>';
}
else
{
echo '<';
}
echo '</span><span style="margin-left:5px">';
if ($page<$pages)
{
echo '<a href="index.php?file=photos&gallery='.$_GET['gallery'].'&page='.($page+1).'"><b>Next > </b> </a>';
}
else
{
echo '>';
}
echo '</span></span>';
echo '<a href="index.php?file=photos&"> [Back to the galleries]</a><hr>';
$x=0;
while ($x<MAXIMAGESPERROW*MAXROWSPERPAGE)
{
if (!isset($thumbs->files[$x+($page-1)*MAXIMAGESPERROW*MAXROWSPERPAGE]))
{
break;
}
echo '<a href="index.php?file=photos&gallery='.$_GET['gallery'].'&image='.($x+($page-1)*MAXIMAGESPERROW*MAXROWSPERPAGE+1).'"><img style="border:none; margin:5px;" src="'.THUMBSPATH.'/'.$name.'/'.$thumbs->files[$x+($page-1)*MAXIMAGESPERROW*MAXROWSPERPAGE].'" alt="'.$thumbs->files[$x].'"></a>';
$x++;
if ($x%MAXIMAGESPERROW==0)
{
echo '';
}
}
unset($thumbs);
}
}
else
{
echo '<b>Galleries</b><hr>';
for ($x=0;$x<count($images->subdirs);$x++)
{
$name=explode("/",$images->subdirs[$x]->name);
$name=$name[count($name)-1];
echo '<a href="index.php?file=photos&gallery='.($x+1).'">'.$name.'</a><br>';
if (SHOWPICCOUNT==true)
{
echo ' - '.count($images->subdirs[$x]->files).' pictures';
}
echo '';
}
}
unset($images);
?>
</body>
</html>