|
Home
About
Testimonials
Advantages
Products
Gallery
Services
History
Fact Sheet
Get a Quote
Contacts
|
|
Gallery |
|
|
//echo "\n";
// Build the menu
if(!isset($_SESSION['menulite'])) {
$_SESSION['menulite'] = array();
$home = false;
$homedir = getcwd();
if ($dir = @opendir($homedir)) {
while ($dirname = @readdir($dir)) {
if (substr($dirname,0,1) != '.' && is_dir($dirname) && $dirname != 'thumbs') {
$_SESSION['menulite'][] = array(str_replace('.', '', $dirname), $dirname);
photoalbums($homedir . '/' . $dirname . '/');
} else if (substr($dirname,0,1) != '.' && !is_dir($dirname) && $dirname != $scriptname) {
$extension = strtolower(substr($dirname, strrpos($dirname,'.') + 1, strlen($dirname)));
if ($extension == 'jpg' || $extension == 'jpeg' || $extension == 'png' || $extension == 'gif')
$home = true;
}
}
}
if ($home && count($_SESSION['menulite']) > 0) {
array_unshift($_SESSION['menulite'], array(basename(dirname(__FILE__)), './'));
}
}
// Print the menu
echo " | \n";
foreach($_SESSION['menulite'] as $key => $url) {
if (substr($url[0],0,1)!='.') {echo "";}
if ($_SESSION['album'] == $key)
echo "$url[0]";
else
echo "$url[0]";
if (key_exists($key + 1, $_SESSION['menulite'])) {
$nextmenuitem = $_SESSION['menulite'][$key + 1];
if (substr($nextmenuitem[0],0,1)=='.') {echo " ";} else {echo " | | \n";}
} else {
echo "\n";
}
}
//echo " | Exit | \n";
//echo " | © EasyPhpAlbum Lite | \n";
echo " \n";
// Insert a banner below the menu, place the code here
// echo "\n";
// Banner code
// echo " | \n";
// Main content
echo " | \n";
// Determine which album to show
if (count($_SESSION['menulite']) == 0) {
$album = './';
} else {
if (isset($_SESSION['album'])) {
if (key_exists($_SESSION['album'], $_SESSION['menulite'])) {
$albumurl = $_SESSION['menulite'][$_SESSION['album']];
$album = $albumurl[1];
}
} else {
$albumurl = $_SESSION['menulite'][0];
$album = $albumurl[1];
}
}
if (!isset($_SESSION['images'])) {
// Read all image files in selected album
$_SESSION['images'] = array();
$newthumbs = array();
if ($dir = @opendir($album)) {
while ($filename = @readdir($dir)) {
if (substr($dirname, 0, 1) != '.' && !is_dir($filename)) {
$extension = strtolower(substr($filename, strrpos($filename,'.') + 1, strlen($filename)));
if ($extension == 'jpg' || $extension == 'jpeg' || $extension == 'png' || $extension == 'gif') {
$_SESSION['images'][] = $filename;
if (!file_exists($album . '/thumbs/' . substr($filename, 0, strrpos($filename, '.')) . ".jpg"))
$newthumbs[] = $album . '/' . $filename;
}
}
}
}
// Save new thumbs if required
if (count($newthumbs) > 0) {
$thumb = new easyphpthumbnail;
$thumb -> Thumblocation = $album . '/thumbs/';
if (!file_exists($thumb->Thumblocation)) {
@mkdir($thumb->Thumblocation);
@chmod($thumb->Thumblocation, octdec($thumb->Chmodlevel));
}
$thumb -> Createthumb($newthumbs);
}
}
// The main table
echo "\n";
// Display the thumbs or photo
$column = 0;
$table = explode('x', $tableformat);
$tablesize = $table[0] * $table[1];
if (isset($_REQUEST['photo'])) {
$photo = basename($_REQUEST['photo']);
} else {
$photo = '';
}
echo "\n";
if ($photo == '') {
// Display thumbnails
if (count($_SESSION['images']) > 0 && count($_SESSION['images']) >= ($page-1)*$tablesize) {
foreach($_SESSION['images'] as $key => $image) {
if ($key >= ($tablesize*($page-1)) && $key < ($tablesize*$page)) {
if ($column == 0) {
echo "";
}
if (file_exists($album . '/thumbs/' . substr($image, 0, strrpos($image,'.') + 1) . 'jpg')) {
echo " | ";
} else {
$size = @getimagesize($album . "/$image");
if ($size[0] > $size[1])
$width = $thumbwidth . 'px';
else
$width = ceil($size[0]/($size[1]/$thumbwidth)) . 'px';
echo " | ";
}
$column += 1;
if ($column == $table[0]) {
$column = 0;
echo " \n";
}
}
}
$lastpageimages = count($_SESSION['images'])-($tablesize*($page-1));
if ($page == ceil(count($_SESSION['images'])/$tablesize) && $lastpageimages < $table[0]) {
echo " \n";
} else if ($column < $table[0] && $column > 0) {
echo str_repeat(' | | ', $table[0]-$column) . " \n" . " \n";
} else {
echo " | \n";
}
} else {
echo " | No images found! | \n";
}
} else {
// Display full size photo
if (in_array($photo, $_SESSION['images'])) {
// Getimagesize is slow but required to display photos within the current screenwidth
$size=getimagesize($album.'/'.$photo);
if ($size[0]>($_SESSION['screenwidth']-360)) {
$width='width : ' . ($_SESSION['screenwidth']-360) .'px';
} else {
$width="width : $size[0]px";
}
$index=array_search($photo, $_SESSION['images']);
if ($browsing && !isset($_REQUEST['slideshow']) && key_exists($index + 1, $_SESSION['images'])) {
$nextf="onmouseover=\"this.bgColor='$buttoncolor';this.style.cursor='pointer';\" title=\"browse forward\" onclick=\"location.href=('$scriptname?page=$page&photo=" . urlencode($_SESSION['images'][$index + 1]) . "');\"";
$nextfs="style=\"width : 30px; border : 1px solid $buttoncolor;\"";
} else {
$nextf='';
$nextfs='style="width : 30px; border : 0px;"';
}
if ($browsing && !isset($_REQUEST['slideshow']) && key_exists($index - 1, $_SESSION['images'])) {
$nextb="onmouseover=\"this.bgColor='$buttoncolor';this.style.cursor='pointer';\" title=\"browse backward\" onclick=\"location.href=('$scriptname?page=$page&photo=" . urlencode($_SESSION['images'][$index - 1]) . "');\"";
$nextbs="style=\"width : 30px; border : 1px solid $buttoncolor;\"";
} else {
$nextb='';
$nextbs='style="width : 30px; border : 0px;"';
}
echo " | \n";
echo "\n";
echo "\n";
echo " | \n";
echo "\n";
if ($show_name)
echo "
" . substr($photo, 0, strrpos($photo, '.'));
echo " | \n";
echo "\n";
echo " | \n";
echo " | \n";
// Slideshow button
if ($slideshow && !isset($_REQUEST['slideshow']))
echo " | \n";
echo " \n";
} else {
echo " | No image found! | \n";
}
}
// Display the amount of pages
if ($tablesize < count($_SESSION['images']) && $photo == '') {
echo "\n";
echo "";
for ($i = 1; $i <= ceil(count($_SESSION['images']) / $tablesize); $i++) {
if ($page == $i) {
echo " $i";} else {echo " $i";
}
}
echo " | \n";
echo " \n";
}
// Close the main table
echo " | \n";
// Insert a banner below the main content, place the code here
// echo "\n";
// Banner code
// echo " | \n";
// End of page
//echo " |