//(C) copyright Metalhead 2003 //This script is released under the terms of the GNU General Public License. A copy of the GPL is included with this script. if(function_exists("imagejpeg")) { $support[1] = "jpg"; $support[2] = "jpeg"; $support[3] = "imagecreatefromjpeg"; $support[4] = "imagejpeg"; } elseif(function_exists("imagegif")) { $support[1] = "gif"; $support[2] = "gif"; $support[3] = "imagecreatefromgif"; $support[4] = "imagegif"; } else { die("There's no GD-Library installed on this machine!"); } if(!$ROOT) { $ROOT = getcwd(); $cut = explode("/", $REQUEST_URI); array_pop($cut); $cut = join("/", $cut); $ROOT = str_replace($cut, "", $ROOT); $ROOT = str_replace("\\", "/", $ROOT); } if(!$main) { echo "
"; } else { if(!$map) { if(!$submit) { if(!$config) { @require("./config.data"); if(!$hpics || !$vpics || !$maxsize || !$border) { $hpics = 3; $vpics = 5; $maxsize = 100; $border = 1; } $thumbsize = $maxsize + ($maxsize/5); if(!$picture) { echo ""; echo ""; $type = strtoupper($support[2]); if(!$dir) { $directory = dirname($PHP_SELF); $dir = getcwd(); $dir = str_replace("\\", "/", $dir); $directory = str_replace("\\", "/", $directory); $directory = str_replace($ROOT, "", $dir); } else { if($ROOT != $dir) { $directory = str_replace($ROOT, "", $dir); } else { $directory = dirname($PHP_SELF); } $directory = str_replace("\\", "/", $directory); if($directory == "/") { $directory = ""; } if(!ereg("^/", $directory) && !empty($directory)) { $directory = "/".$directory; } chdir($dir); } echo "$type images in http://$SERVER_NAME$directory
";
$handle = opendir('.');
while($file = readdir($handle))
{
if(is_file($file) && ereg(".$support[1]$", "$file"))
{ $retval[] = "$file"; }
}
closedir($handle);
if(!$retval)
{
echo "There are no such images in the specified directory.";
}
else
{
sort($retval);
reset($retval);
$total = sizeof($retval);
if(!$page)
{ $page = 1; }
$maxpics = $hpics * $vpics;
$pagetotal = ceil($total / $maxpics);
$current = $maxpics * ($page - 1);
$check = $current + $maxpics;
$current1 = $current + 1;
if($check < $total)
{
$current2 = $current + $maxpics;
}
else
{
$current2 = $total;
}
echo "Displaying images $current1 to $current2 of $total
Page $page of $pagetotal";
$y = 0;
echo "
$retval[$x] | ";
$y = $y + 1;
$z = $y / $hpics;
if($z == round($z, 0))
{
echo "
| "; if($page == 1) { if($current2 < $total) { echo " | Next -->"; } } else { if($current2 == $total) { echo "<-- Previous | "; } else { echo "<-- Previous | Next -->"; } } echo " |
";
if($spics != 0)
{ echo "http://$SERVER_NAME$prefix/"; }
else
{ echo "http://$SERVER_NAME$prefix/"; }
echo " ($spics images) |
![]() |
";
for($z=1; $z<=$count; $z++)
{
if(isset($last) && !isset($skip[$z-1]) && $z == $last+1)
{
echo " ";
}
elseif(isset($skip[$z-1]))
{
if($skip[$z-1] == 1)
{ echo " "; }
else
{ echo " "; }
}
else
{ echo " "; }
}
if($y == sizeof($sdirs) -1)
{
echo " ";
if($last < $count && isset($last))
{
$skip[$last] = 1;
$skip[$count] = 1;
}
else
{
$last = $count;
unset($skip);
}
}
else
{
echo " ";
}
$cwd1[0] = $dir;
$cwd1[1] = $sdirs[$y];
$chdir = join("/", $cwd1);
$chdir = str_replace("\\", "/", $chdir);
chdir($chdir);
$handle = opendir('.');
while ($file = readdir($handle))
{
if(is_file($file) && ereg(".$support[1]$", "$file"))
{ $spics ++; }
}
if($spics > 0)
{ echo " $sdirs[$y]"; }
else
{ echo " $sdirs[$y]"; }
echo " ($spics images) |