Просмотр файла pic.php

Размер файла: 578B
<?php
require_once "rdx.php";	//Including our class
$file = ''.htmlspecialchars($_GET['thumb']).'';
$name = 'thumb/'.str_replace('/','-',$file).'';
$location = 'http://'.str_replace(array('\\','//'),array('/','/'),$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/'.$name);
if(file_exists($name)){
header('Location: '.$location, true, 301);
exit;
}

   $image = new SimpleImage();
   $image->load($file);
   $image->resize(124,102);
   $image->save($name);
header('Content-Type: image/jpeg');

readfile($name);
header('Location: '.$location, true, 301);
?>