<?php
# Constants

$cacheDir = '/var/www/marsensing/www.marsensing.com/htdocs/tmp';

require '/var/www/marsensing/www.marsensing.com/htdocs/func.thumbnails.php';

$image_base = '/var/www/marsensing/www.marsensing.com/htdocs/fotos';

//define(IMAGE_BASE, '/var/www/marsensing/www.marsensing.com/htdocs/fotos');
//define(MAX_WIDTH, 150);
//define(MAX_HEIGHT, 20);

$tmp = urldecode($_SERVER['QUERY_STRING']);

# Get image location
#$image_file = str_replace('..', '', $_SERVER['QUERY_STRING']);
$image_file = str_replace('..', '', $tmp);
//$file = IMAGE_BASE . "/$image_file";
$file = $image_base . "/$image_file";

if (is_readable($file)) {
	$mtime = gmdate('D, d M Y H:i:s \G\M\T', filemtime($file));
	header('Content-type: image/png');
	header('Connection: close');
//                header("Date: $mtime");
//                header("Last-Modified: $mtime");
	pngThumbnail("$file");
	exit();
} else {
//	echo "blah $file";
//	echo getcwd();	
}
?>
