<?
$filename = str_replace('/', '', $_SERVER['REQUEST_URI']);
$match = preg_match("/^[A-z0-9]*\.(jpg|jpeg|png|gif)$/", $filename);
if (!$match) {
	echo "nope ". $filename;
	exit();
}

$filename = "./img/". $filename;

if (!file_exists($filename)) {
	echo "Not found";
	exit(404);
}

$split = explode(".", $filename);
//$content_type = finfo_file(finfo_open(FILEINFO_MIME_TYPE, $filename));
//header('Content-Type: '. $content_type);

$img = new \Imagick(realpath($filename));
$img->scaleImage(50, 50, true);

//echo $img->getImageBlob();

?>
hi
