View file sea/im.php

File size: 1.53Kb
<?
#-----------------------------------------------------#
#     ============ЗАГРУЗ-ЦЕНТР=============           #
#             	 Автор  :  Sea                   	  #
#               E-mail  :  [email protected]              #
#                  ICQ  :  355152215                   #
#   Вы не имеете права распространять данный скрипт.  #
#   		По всем вопросам пишите в ICQ.            #
#-----------------------------------------------------#
include 'moduls/ini.php';
include 'moduls/connect.php';
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']);
	$file_info = mysql_fetch_array(mysql_query("SELECT * FROM `files` WHERE `id` = '".$id."'"));
	$pic = urldecode(htmlspecialchars($file_info[path]));
	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");
  		}
 	}
}
?>