<?php
$tempDir = "./temp/";

if(!isSet($_GET['name'])){
  exit;
}

$name = $_GET['name'];

if(!preg_match('/^[0-9. ]+$/', $name)){
  exit;
}

if(!($img = imagecreatefromjpeg($tempDir.$name))){
  exit();
}
header('Content-Type: image/jpeg');
imagejpeg($img);
imagedestroy($img);
unlink($tempDir.$name);
?>