Просмотр файла games/im.php

Размер файла: 1.05Kb
<?
include('modul/fun.php');
include('modul/config.php');
	$file_info = mysql_fetch_array(mysql_query("SELECT * FROM `files` WHERE `id`='".$id."'"));
if (!ctype_digit($id) or (!ctype_digit($W) and isset($W)) or (!ctype_digit($H) and isset($W)) ) die($hackmess);
else
{
	header("Content-type:image/jpeg");
	$W=intval($_GET['W']);
	$H = intval($_GET['H']);
	$pic=urldecode(htmlspecialchars(''.$file_info['infolder'].'/'.$file_info['name'].''));
	if(substr($pic,0,1)!=".")
	{
 		if(preg_match("/\.gif$/i", $pic)) $old = imageCreateFromGif("$pic");
 		if(preg_match("/\.jpg$|\.jpeg$|\.jpe$/i", $pic)) $old = imageCreateFromJpeg("$pic");
  		if(preg_match("/\.png$/i", $pic)) $old = imageCreateFromPNG("$pic");
  		{
    		$w = imageSX($old);
    		$h = imageSY($old);
    		if($W=="" and $H=="")
    		{
    			$size = explode("*",$setup['prev_size']);
$W=round(intval($size[0]));
$H=round(intval($size[1]));
    		}
  			$new = imageCreateTrueColor($W, $H);
imagecopyresized($new, $old, 0, 0, 0, 0, $W, $H, $w, $h);
imageJpeg($new,"","100");
  		}
 	}
}
?>