File size: 756B
<?
$ff=$_GET['f'];
$info=getimagesize($ff);
$w_or=$info[0];
$h_or=$info[1];
$type=$info['mime'];
$im1='';
if($type=='image/jpeg')
$im1=ImageCreateFromJpeg($ff);
if($type=='image/gif')
$im1=ImageCreateFromGif($ff);
if($type=='image/png')
$im1=ImageCreateFromPng($ff);
if(!$im1) die('ошибка');
if($w_or>$h_or) { $k=$w_or/60;
} else {
$k=$h_or/60; }
$w=round($w_or/$k);
$h=round($h_or/$k);
$im2=imagecreatetruecolor($w,$h);
imagecopyresampled($im2,$im1,0,0,0,0,$w,$h,$w_or,$h_or); if($type=='image/jpeg') {
header('Content-type:image/jpeg');
ImageJpeg($im2);
} elseif ($type=='image/gif') {
header('Content-type:image/gif');
ImageGif($im2);
} elseif ($type=='image/png')
{
header('Content-type:image/png');
ImagePng($im2);
}
else
die('ошибка');
?>