level < User::LEVEL_ADMIN) { if(Core::$user->id != $test->tester_id) throw new Exception("You do not have permission to access this resource."); } $directory = $test->getDirectory(); $path = $directory . "/" . $name . ".jpg"; if(file_exists($path)) { header("Content-Type: image/jpeg"); readfile($path); } else { header("Content-Type: image/png"); readfile("public/img/blank.png"); } ?>