Просмотр файла dl/screen_pic.php

Размер файла: 2.63Kb
<?php
#********************************** AgS MOD DOWNLOAD CENTR SEA *************************************#
#***************************************************************************************************#
#  /||||||||||||||| *********************  /||||||||||||||| *********************  /||||||||||||||| #
# | ||||||||||||||| ********************* | ||||||||||||||| ********************* | ||||||||||||||| #
# | |||||/////||||| ********************* | |||||/////////  ********************* | |||||/////////  #
# | |||||   | ||||| ****** E-MAIL ******* | |||||           ****** WAP/WEB ****** | |||||           #
# | |||||   | ||||| *** [email protected] *** | |||||           * http://ags.h2m.ru * | ||||||||||||||| #
# | |||||   | ||||| ********************* | ||||||||||||||| ********************* | ||||||||||||||| #
# | |||||   | ||||| ********************* | |||||/////||||| ********************* |///////////||||| #
# | ||||||||||||||| ****** SKYPE ******** | |||||   | ||||| ***** MOD AUTHOR ****           | ||||| #
# | |||||////|||||| ***** agrizz15 ****** | |||||   | ||||| ***** Agris Cišs ****  /||||||||||||||| #
# | |||||   | ||||| ********************* | ||||||||||||||| ********************* | ||||||||||||||| #
# |/////    |/////  ********************* |///////////////  ********************* |///////////////  #
#***************************************************************************************************#
#********************************* MOD by AgS in 2010 @ LATVIA *************************************#


require_once"system/start.php";
require_once"system/config.php";
require_once"system/db.php";

header('Content-type: image/jpeg');
header('Cache-Control: public');
header('Pragma: cache');

$W = intval($_GET['W']);
$H = intval($_GET['H']);
$id = intval($_GET['id']);

$file_info = mysql_fetch_row(mysql_query('SELECT TRIM(`path`) FROM `'.$MY_pre.'faili` WHERE `id` = '.$id.' LIMIT 1'));
$pic = urldecode(htmlspecialchars($file_info[0]));

if(substr($pic,0,1) != '.'){

$type = strtolower(pathinfo($pic, PATHINFO_EXTENSION));

if($type == 'gif'){
$old = imageCreateFromGif($pic);}elseif($type == 'jpg' || $type == 'jpeg' || $type == 'jpe'){
$old = imageCreateFromJpeg($pic);}elseif($type == 'png'){
$old = imageCreateFromPNG($pic);}
else{
exit;
}

$wn = imageSX($old);
$hn = imageSY($old);

$size = explode('*',$setup['prev_size']);
$W = round(intval($size[0])); // bildes platums
$H = round(intval($size[1])); // bildes augstums



$sxy = round($wn/$hn,3);
if($sxy<1){$W=intval($H*$sxy);}else{$H=intval($W/$sxy);}


$new = imageCreateTrueColor($W, $H);
imageCopyResampled($new, $old, 0, 0, 0, 0, $W, $H, $wn, $hn);



imageJpeg($new,'',100);


}


?>