<?php
// +----------------------------------------------------------------------+
// | ThumbEasy version 2.0 |
// +----------------------------------------------------------------------+
// | Copyright (c) 2002 Michele Tufano |
// +----------------------------------------------------------------------+
// | You may not remove the copyright or redistribute the script in any |
// | form. This script is freeware and you can modify as you want. |
// | |
// | More script will be avalaible soon ! |
// | |
// +----------------------------------------------------------------------+
// | Authors: Michele Tufano <mike66@libero.it> |
// +----------------------------------------------------------------------+
//
//include("../imglib.php");
// the page header
include("top.php");
/////////////////
// config variable
$col = 4; // number of column
$maxrow = 3; // max row for table
$picdir = ".";
$dpic = opendir($picdir);
while($folder = readdir($dpic))
{
if($folder!="." && $folder!=".." && is_dir($folder))
{
if(substr($folder,-3)!="jpg")
$seldir[] = $folder;
}
}
/////////////////////////////////////////////////////////
// natural alphabetical sort of directory available
// if you have problem or error, comment the line below
natsort($seldir);
/////////////////////////////////////////////////////////
foreach($seldir as $value)
{
// $dirname = strtoupper(str_replace(" ","_ ",$value));
$alldir[] = "$value";
}
//$alldir = array("auto","car","caravan","truck"); // the directory where your images are
////////////////////////
// print the category list
// Prima c'era questa stringa print "<table width=100% border=0 height=\"100%\"><td bgcolor=#F2F2F2 width=\"17%\">";
print "<font face=verdana size=2>Scegli il gruppo di immagini: <br>\n <br>\n"; //Iniziava con <table><tr><th> e finiva con </TH></TR>
foreach($alldir as $key)
{
$dirname = strtoupper(str_replace("_"," ",$key));
print "<tr><td><a href=\"index.php?dir=$key\">$dirname <br>\n</a></td></tr>"; //Prima era iniziato il TAG con <tr> e <td> e alla fine era chiuso con i relativi tag chiusi
}
//Qui c'era questa stringa print "</TABLE></TD><TD width=\"83%\">";
if(isset($dir))
{
// open the directory
$dh = opendir("$picdir/$dir");
while($file = readdir($dh))
{
if( (substr($file,-3)=="gif") || (substr($file,-3)=="jpg") )
{
// insert all images in array
$a_img[] = $file;
}
}
$totimg = count($a_img); // total images number
$totxpage = $col*$maxrow; // images x page
$totpages = ($totimg%$totxpage==0)?((int)$totimg/$totxpage):((int)($totimg/$totxpage)+1); // number of total pages
//////////////////////////////////////////////////////////////////
//
// Start to print and page break
//
//////////////////////////////////////////////////////////////////
if($totimg == false)
print "<br><center><font size=2 face=verdana>No Images avalaible in<br> <b>".strtoupper($_GET[dir])."</b> directory yet!!</font><br>";
else
{
?>
<center>
<table width="90%" bgcolor="#FFFFCC" border="1" bordercolor="#ffffff" cellpadding="2" cellspacing="1">
<tr>
<td colspan="<?=$col-1?>" bgcolor="#BCCFE2"> <b><?=strtoupper($dir)?></b></td>
<td bgcolor="#BCCFE2" align="right"><SPAN style="color:#FFFFFF;font-size: 11px; font-weight:bold;font-family:Verdana, Arial, Helvetica, sans-serif">Totale Immagini
: <?=$totimg?></span> </td>
</tr>
<?
// start page
if($page=="" || $page==1)
{
$x=0;
$page = 1;
}
else
$x = (($page-1)*($totxpage));
$r=0;
// print of table
foreach($a_img as $key=>$val)
{
if(($x%$col)==0)
print "<tr>\n";
if($a_img[$x])
{
// create thumbnail with imglib
$imagehw = getimagesize("$picdir/$dir/$a_img[$x]");
$height = 120;
$width = (int)(($imagehw[0]*120)/$imagehw[1]);
/////////
$ctime = filectime("$picdir/$dir/$a_img[$x]");
if("$dir/$a_img[$x]" !="")
print "<td align=center><a href=\"javascript
:;\" onClick=\"window.open('$picdir/$dir/$a_img[$x]','','width=$imagehw[0],height=$imagehw[1]')\" ><img src=\"$picdir/$dir/$a_img[$x]\" height=$height width=$width border=0></a><br>$a_img[$x]</td>\n";
}
if(($x%$col) == ($col-1))
{
print "</tr>\n";
$r++;
}
// print "r=$r - maxrow=$maxrow<br>";
if($r==$maxrow)
{
break;
}
else
$x++;
}
print "</table>\n";
}
// page break
if($totimg>$totxpage)
{
?>
<table width="90%" bgcolor="#FFFFCC" border="1" bordercolor="#ffffff" cellpadding="2" cellspacing="1">
<tr>
<td bgcolor="#BCCFE2" align="center">
<?
if($totpages>$page)
{
$next = $page+1;
$back = ($page>1)?($page-1):"1";
if($page>1)
{
$back = $page-1;
print "<a class=\"page\" href=index.php?page=$back><< back </a>";
}
print " <span class=\"page\"><b>gallery $page of $totpages</b></span> <a class=\"page\" href=index.php?page=$next&dir=$dir>next >></a>";
}
else
{
$next = (($page-1)==0)?"1":($page-1);
print "<a class=\"page\" href=index.php?page=$next&dir=$dir><< back</a> <span class=\"page\"><b>gallery $page of $totpages</b></span> ";
}
}
print "</TD></TABLE>";
}
///
//////////////////////////////////////////////////////////////////////////////////////////////////
// your footer page
include("../bottom.php");
?>