<?php
	if (isset($_GET['pitem'])) {
		$item = $bilderordner.SEPARATOR.$bilderliste[$_GET['pitem']];
		$item = dirname($_SERVER['SCRIPT_FILENAME']).SEPARATOR.$item;
		
		$fp = fopen($item, 'r');
		
		// Content-type ermitteln
		$imageInfo = getimagesize($item);
		switch ($imageInfo[2]) {
			case 1:
				header('Content-type: image/gif');
				break;
			case 2:
				header('Content-type: image/jpeg');
				break;
			case 3:
				header('Content-type: image/png');
				break;
			case 4:
				header('application/x-shockwave-flash');
				break;
			default:
				header('Content-type: text/plain');
		}
		
		fpassthru($fp);
		fclose($fp);
		exit;
	}
?>
