<?php
error_reporting(0);
$sc=$_SERVER['SCRIPT_NAME'];
$sc=str_replace("yuan.php","",$sc);
$tou="userfiles/touxiang";
$name=$_GET['t'];
$path=$_SERVER['DOCUMENT_ROOT']."{$sc}{$tou}/{$name}";
if(!file_exists($path)){

$path=$_SERVER['DOCUMENT_ROOT']."{$sc}{$tou}/guest.gif";
}
$infor=getimagesize($path);
$mime=$infor[mime];

if(stristr($mime,"jpeg")){
$im=imagecreatefromjpeg($path);//获取源图

imagejpeg($im);//输出图片

}elseif(stristr($mime,"gif")){
$im=imagecreatefromgif($path);

imagegif($im);
}elseif(stristr($mime,"png")){
$im=imagecreatefrompng($path);
imagepng($im);
}
imagedestroy($im);
?>