Location: PHPKode > projects > Wiki Web Help > wwh/handlers/imagepage.php
<?php
require_once("../config.php");
include('language.php'); 

$title = $_GET['title'];
$html =  "<div style='float:left;font-size:18px;'>".$language->images." : </div>";
$html .=  "<div style='float:right;'><div style='position:relative;'>"
			."<a href=\"javascript:previewcancel('$title')\">".$language->cancel."</a></div></div>";
			
$html.="<div style='float:right;margin-right:20px;'>
<form onsubmit='validateupload(\"$title\");' method='post' enctype='multipart/form-data' target='upload_target' action='handlers/uploadimage.php'>
<div id='uploadpanel'>
<input name='imagefile' id='imagefile' size='27' type='file' value='".$language->choosefile."'/>
<input id='imagesubmit' type='submit' name='action' value='".$language->upload."' />
</div>
<iframe id='upload_target' name='upload_target' src='' style='width:0;height:0;border:0px solid #fff;'></iframe>
</form></div>"			;
			
$html .=  "<div style='float:right;'><div style='position:relative;margin-right:20px;'>"
			."<div id='up' style='position:absolute;left:-300px;z-index:100;display:none;'></div>"
			."</div></div>";
$html .=  "<span style='display:none' id='holder' ></span>";
$html .=  "<div style='height:100%;clear:both;'>";

$ip=$_SERVER['REMOTE_ADDR'];

$sql = "SELECT ip_address FROM blocked WHERE ip_address='$ip'";
$result = mysql_query($sql,$con) or die("Database Error - Unable to retrive page.");
$blocked = mysql_numrows($result) > 0;

if($blocked){
	echo "You do not have permission to manage images"; exit;	
}

$handler = opendir("../images");
while ($file = readdir($handler)) {

    if ($file != '.' && $file != '..'){

    	$size = getimagesize("../images/$file");
		if($size == NULL) continue; // not an image
		
		$x = $size[0];
		$y = $size[1];
		$aspect = $x / $y;
		
		// set maximum size TODO: create thumbnails when uploading and do this there
		if($x > 100){
			$x = 100;
			$y = $y / $aspect; 
		}
		if($y > 100){
			$y = 100;
			$x = $x * $aspect; 
		}
        $html .= "<a href=\"javascript:sysclipboard('../images/$file')\">"
		."<img src='images/$file' style='width:{$x}px;margin:12px;' title='click to select' /></a>";
    	
    }
}

closedir($handler);

echo $html;
?>
Return current item: Wiki Web Help