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

Размер файла: 2.87Kb
<?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);

$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);

if($setup['marker']){
$bg = imagecolorallocate($new, 255, 255, 255);// fons
$color = imagecolorallocate($new, 200, 200, 200);// krāsa
imagestring($new, 2, ($W/2)-(strlen($setup['text_marker'])*3), 1, $setup['text_marker'], $color);}

imageJpeg($new,'',100);

mysql_query('UPDATE `'.$MY_pre.'faili` SET `loads`=`loads`+1, `timeload`='.$time.' WHERE `id`='.$id);
}
?>