Location: PHPKode > scripts > Easy Image Catalogue (EIC) > easy-image-catalogue-eic/index_safe.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN "
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="basicstyles.css" type="text/css">
<style type="text/css">
	@import "styles.css";
</style>
<title>Easy Gallery</title>
</head>
<body>
<?php include_once("eic_functions.php");?>
<?
$search=$HTTP_GET_VARS['search'];
$s=$HTTP_GET_VARS['s'];
$r=$HTTP_GET_VARS['r'];
$d=$HTTP_GET_VARS['d'];
$p=$HTTP_GET_VARS['p'];
$a=$HTTP_GET_VARS['a'];
?>
<div class="content">
	<div id="menu">
		<a href="index.php">Home</a>
<!-- 		<a href="about.php">About</a>
		<a href="credits.php">Credits</a>
		<a href="help.php">Help</a> -->
		<form><input type="text" name="search" size="5" value="" class="input" />
		<input type="submit" value="go" /></form>
	</div>
<div class="banner">
<form>
Please select the desired gallery:
<select name="d" onchange="document.forms[1].submit()">
<?
$allfiles=directory(".","all");
natsort($allfiles);
foreach ($allfiles as $a){
	if (!preg_match("/^\.|counterdata/",$a) and is_dir($a)){
		if (file_exists("counterdata/".$a."info.xml")){
			$name=untag(load("counterdata/".$a."info.xml"),"galleryname",0);
			if ($name==""){$name=$a;}
			if ($d==$a){echo "<option value=\"$a\" selected=\"selected\">$name</option>";}
			else {echo "<option value=\"$a\">$name</option>";}
			$name="";
		}
	}
}
?>
</select><input type="submit" value="go" /></form>
</div>
<div class="breaker"></div>
<?
/*------------------------------------------------------------------------------
		No search initiated
------------------------------------------------------------------------------*/ 
if ($search==""){

// no folder set
	if ($d==""){
		$allfiles=directory(".","all");
		natsort($allfiles);
		foreach ($allfiles as $key=>$a){
			if (file_exists("counterdata/".$a."info.xml")){
				$name=untag(load("counterdata/".$a."info.xml"),"galleryname",0);
				if ($name==""){$name=$a;}
				//if (($key%2)==0){echo "<div class=\"breaker\"></div>";}
				if (!preg_match("/^\.|counterdata/",$a) and is_dir($a)){
					$files=directory($a,"jpg,JPG,JPEG,jpeg,gif,GIF,png,PNG");
					$files=ditchtn($files);
					echo "<div class=\"item\"><div><a href=\"index.php?d=$a\"><img src=\"$a/preview.jpg\" border=\"0\"></a></div>";
					echo "<p>Gallery: <strong>$name</strong><br />";
					echo count($files)." pictures. ";
					echo "Accessed ".load("counterdata/$a.txt")." times.</p>";
					echo untag(load("counterdata/".$a."info.xml"),"galleryinfo",0);
					echo "";
					echo "</div>";
				}
			}
		}
	} else {
// folder is known
		$it=untag(load("counterdata/".$d."info.xml"),"item",1);
		$name=untag(load("counterdata/".$d."info.xml"),"galleryname",0);
		$galinfo=untag(load("counterdata/".$d."info.xml"),"galleryinfo",0);
		if ($name==""){$name=$d;}
// image is unknown
		if ($p==""){
			// counter
			if ($r!=1){
				if (file_exists("counterdata/$d.txt")){
					$c=load("counterdata/$d.txt");
					$c++;
				}
				else{$c=1;}
				save("counterdata/$d.txt",$c);
			}
		
			$files=directory($d,"jpg,JPG,JPEG,jpeg,gif,GIF,png,PNG");
			$files=ditchtn($files);
			if ($name==""){$name=$d;}
			
			echo "<h4>Gallery $name ".count($files)." images.</h4>";
			echo "<div class=\"info\">$galinfo</div>";
			
			natsort($files);
			foreach ($files as $a){
				echo "<div class=\"galleryitem\">";
				$big=getimagesize("$d/$a");
				if ($it[0]!=""){foreach($it as $i){if(untag($i,"image",0)==$a){$info=untag($i,"copy",0);}}}
				echo "<a href=\"index.php?d=$d&p=$a\" class=\"img\"><img src=\"$d/tn_$a\" title=\"$info\" border=\"0\" /></a><br />";
				$alt="";
				$alt.="$big[0]x$big[1] px <br /> ";
				$alt.="Size:".round((filesize("$d/$a")/1024))." kb<br /> ";
				echo $alt;
				echo "</div>";
			}
// image is known
		}else{
			if ($it[0]!=""){foreach($it as $i){if(untag($i,"image",0)==$p){$info=untag($i,"copy",0);}}}
			$size=getimagesize("$d/$p");
			if ($s!=""){
				echo "<div align=\"center\"><a href=\"index.php?search=$s\"><img src=\"$d/$p\" $size[3] alt=\"$info\" border=\"0\" /></a></div>";
			}
			else {
				$files=directory($d,"jpg,JPG,JPEG,jpeg,gif,GIF,png,PNG");
				$files=ditchtn($files);
				echo "<h4>Gallery $name ".count($files)." images.</h4>";
				foreach ($files as $k=>$pn){
					if ($pn==$p){
						$next="";
						$last="";
						$ispic=$k+1;	
						if ($k != 0){$last=$files[$k-1];}
						if ($k != count($files)){$next=$files	[$k+1];}
					}
				}
				echo "<div align=\"center\">";
				if ($last!=""){echo "<a href=\"index.php?p=$last&d=$d\">&#171; previous image</a>&nbsp;&nbsp;";}
				echo "Image $ispic/".(count($files));
				if ($next!=""){echo "&nbsp;&nbsp;<a href=\"index.php?p=$next&d=$d\">next image &#187;</a>";}
			echo "<br /><br /><a href=\"index.php?d=$d&r=1\"><img src=\"$d/$p\" $size[3] alt=\"$info\" border=\"0\" /></a>";
			}
		
			if ($info!=""){echo"<div align=\"center\"><div class=\"info\" style=\"width:".$size[0]."px\">$info</a></div>";}
			echo"</div>";
			$c=$d.str_replace(".","",$p);
			$pop="no";
			include ("comments.php");
		}
	}
}else{

/*------------------------------------------------------------------------------
	Search initiated
------------------------------------------------------------------------------*/ 
	echo "<h4>Search pictures</h4>";
	$found=0;
	$files=directory("counterdata","xml");
	foreach ($files as $f){
		$items=untag(load("counterdata/".$f),"item",1);
			if ($items[0]!=""){
				foreach ($items as $i){
					if (preg_match("/".$search."/si",$i)){
						$url=str_replace("info.xml","",$f)."/tn_".untag($i,"image",0);
						$size=getimagesize($url);
						echo "<a href=\"index.php?s=$search&d=".str_replace("info.xml","",$f)."&p=".untag($i,"image",0)."\"><img src=\"$url\" class=\"search\" border=\"0\" $size[3] alt=\"".untag($i,"copy",0)."\" /></a>";
						$found++;
					}
				}
			}
		}
	if ($found==0){echo "<div class=\"breaker\">Sorry, no image matched your search &#34;$search&#34;</div>";}
	else {echo "<div class=\"breaker\">$found image(s) matched your search &#34;$search&#34;</div>";}
}
?>
<div class="breaker">&nbsp;</div>
</div>

</body>
</html>
Return current item: Easy Image Catalogue (EIC)