tag) $hSub = 90; // Height of subfolder thumbs $rewrite = 1; // Use mod_rewrite /***** No further user set options below here. *****/ /* TODO: script execution clock */ /* $time = microtime(); $time = explode(' ', $time); $time = $time[1] + $time[0]; $begintime = $time; */ // TODO: the following must also be the same in image_resize.php //$cache_thumbs = 1; // Set to 1 to store thumbs in _di-cache directory in root folder $cache_dir = '_di-cache'; // Name of cache directory if you so choose /* setup the script */ $rootdir = stripslashes(dirname($_SERVER['SCRIPT_NAME'])); $rootlink = htmlentities($rootdir, ENT_QUOTES).'/'; // If not specified, use top folder for gallery name if(!$rootname){ $rootname = explode('/', $rootdir); $rootname = htmlentities(end($rootname), ENT_QUOTES); } if ($_GET[d]) { $d = stripslashes(urldecode($_GET['d'])); // remove escape characters $d .= '/'; // put trailing slash after its converted to a string $current_dir .= $d; $replace = array ("_", "/", "\\"); $with = array (" ", " - ", ""); $title = htmlentities(str_replace($replace, $with, $_GET[d]), ENT_QUOTES); } else $title = 'Home'; if($_GET[v]) $title .= ' - '.htmlentities(str_replace("_", " ", eregi_replace('((\.jpg)|(\.gif)|(\.png))', '', $_GET[v])), ENT_QUOTES); if($rewrite) { if($_GET[d]) $d_string = escape(stripslashes(urldecode($_GET['d']))).'/'; } else { $d_string = '?d='; // for use in passing to URL strings $d_val = stripslashes(escape($_GET['d'])); } if($pg = $_GET['pg']) { $start_from = (($pg-1)*$limit); if($rewrite) $pg_delim = 'page'.$pg.'/'; else $pg_delim = '&pg='.$pg; } else $img = 0; if($rewrite) { $pg_string = 'page'; $pg_term = '/'; } else $pg_string = '&pg='; if($rewrite) $v_string = 'view/'; else $v_string = '&v='; if(ereg("\.\.", $_GET['d'])) // important to prevent browsing upper directories header ("Location: ?"); // additional paramaters for
(thumbnails) - based on whether name or dimensions is displayed $pwidth = $w+12; $pheight = $h+12; if($ititle) $pheight +=10; // increase height of thumbnail
element if($isize || $idim) // if displaying dimensions or size of image, increase height of thumbnail
element. $pheight +=10; /*** Get list of folders ***/ $folder_list = count_folders(); $num_folders = count($folder_list); /*** Get list of Images ***/ $img_list = array(); if ($dir = opendir("./$current_dir")) { while ($file = readdir($dir)) { if ((eregi('((.jpg)|(.gif)|(.png))', $file)) && ($file != $icon)) // Don't add the icon to the list $img_list[] = $file; } closedir($dir); } asort($img_list); // sort alpha $num_images = count($img_list); // total number of images in folder $whole_img_list = $img_list; // save it before we chunk it $paginated = array_chunk($whole_img_list, $limit); if ($pg) $img_list = $paginated[($pg-1)]; $num_remain = $num_images-$start_from; // total remaining thumbs in the array (current directory) ?>
sub_img_list (list of folder with first image) '; print_r($sub_img_list); echo '
\n";
if (!$preview) // just link right to the image
echo ' ';
else // image previewed inside gallery
echo ' ';
// TODO: possible use the key of whole_img_list instead of sending image name in URL
if ($cache_thumbs)
{
$myPic = $d.$pic;
$thumbnailFile = $cache_dir."/".str_replace("/", "_~_", $myPic);
//$thumbnailFile = $cache_dir."/".basename($pic);
}
//TODO: cached thumbnail integration
////if(file_exists($thumbnailFile))
//// echo '';
//// if thumbnail is in cache, do not recreate it.
//// will need modification to check if dimensions are correct
////else
echo "
";
if($ititle)
echo "
".htmlentities($iname, ENT_QUOTES)."";
if ($idate)
echo " - ".date("F d", filemtime($current_dir.$pic))."";
echo " \n
";
if($idim)
echo "$i_width x $i_height";
if($idim && $isize)
echo " - ";
if ($isize)
echo "[$i_size]";
echo "