<?
// The CODE below must be in .htaccess

//CODE: <FilesMatch "^index$"> 
//CODE:   ForceType application/x-httpd-php 
//CODE: </FilesMatch>

//END

$a = $_SERVER['REQUEST_URI'];
$b = $_SERVER['SCRIPT_NAME'];
$image = eregi_replace("$b/", "", $a);
function display($image,$num) {
  if ($num == 1) { $create = imagecreatefromgif($image); imagegif($create); }
  if ($num == 2) { $create = imagecreatefromjpeg($image); imagejpeg($create); }
  if ($num == 3) { $create = imagecreatefrompng($image); imagepng($create); }
  if ($num == 7) { $create = imagecreate($image); image($create); }
}
if (is_file($image)) {
  $type = exif_imagetype($image);
  display($image,$type);
}
?>
Published in: PHP
Download

Related snippets