Просмотр файла downimg.php

Размер файла: 4.05Kb
<?php
#----00--00----------------------------------#
#----00---000----000000-----000000-#
#----00---0000--00----00----00---00--#
#----00---0000--00-----------00---------#
#----00---0000--000000----00000--#
#----00---000---00-----------00---------#
#----00--00-----00---00-----00---------#
#----0000-------000000----00--------#
#################################################
##                    W@P-MOTOR 16 - 17 DOWNLOAD CENTER MOD Def                     ##
##                                      Дата выхода 5 февраля 2008 г.                                        ##
##                                         Авторы: XsErG, VantuZ, Def                                            ##
##                                             Связь: http://wapruk.ru                                                  ##
#################################################
include ("inc/func.inc");
require ("inc/conf.inc");

extract($HTTP_GET_VARS);
extract($HTTP_POST_VARS);
$time=time();
//////////////////////////запись количества скачиваний//////////////////////////////	
if (@is_file("files$did/$im")){
$dik=str_replace("/", "", $did);
if (@is_file("baze/$dik.baz")){
$fn=@file("baze/$dik.baz");
$fp=@fopen("baze/$dik.baz","a+");
flock ($fp,LOCK_EX);
ftruncate ($fp,0);
	foreach ($fn as $n=>$f){
		$data = explode("|",$fn[$n]);
		if ($data[0]==$id and $data[11]=="$did/$im"){$kol=$data[1]+1;
		$zap="$data[0]|$kol|$data[2]|$data[3]|$data[4]|$time|$data[6]|$data[7]|$data[8]|$data[9]|$data[10]|$data[11]|\r\n";
		fputs($fp,"$zap");}
		else{fputs($fp,$fn[$n]);}
		fflush ($fp);
	}
flock ($fp,LOCK_UN);
fclose($fp);
@chmod("baze/$dik.baz", 0666);	
}}

$image = check_fulls(@$_GET['im']);
$did = check_fulls(@$_GET['did']);
$types = array(1 => "gif", 2 => "jpeg", 3 => "png", 4 => "jpg");
$destination = $did.'/small_'.$image;
$image = "files".$did.'/'.$image;

$neww = (@$_GET['neww']);
$newh = (@$_GET['newh']);

if ($neww == '' && $newh == ''){ $neww = 60; $newh = 60;}

$new_w = isset($_GET['w']) ? (int) $_GET['w'] : $neww;
$new_h = isset($_GET['h']) ? (int) $_GET['h'] : $newh;
if ($image_info = getimagesize($image))
{	
	$image_create_handle = "imagecreatefrom".$types[$image_info[2]];
	if (!$im = @$image_create_handle($image)) exit;	
	$neww = imagesx($im);
	$newh = imagesy($im);
	$ratio = $neww/$new_w; 
	$w_dest = round($neww/$ratio); 
	$h_dest = round($newh/$ratio);
	$dest = imagecreatetruecolor($w_dest,$h_dest);
	imagecopyresized($dest, $im, 0, 0, 0, 0, $w_dest, $h_dest, $neww, $newh);
	if ($im_wd == 1)
	{
		// вывод текста
		// определяем координаты вывода текста
		$size = &$im_ts; // размер шрифта
		$x_text = $w_dest-imagefontwidth($size)*strlen($im_title)-3;
		$y_text = $h_dest-imagefontheight($size)-3;
		// определяем каким цветом на каком фоне выводить текст
		$white = imagecolorallocate($dest, 255, 255, 255);
		$black = imagecolorallocate($dest, 0, 0, 0);
		$gray = imagecolorallocate($dest, 127, 127, 127);
		if (imagecolorat($dest,$x_text,$y_text)>$gray) $color = $black;
		if (imagecolorat($dest,$x_text,$y_text)<$gray) $color = $white;
		// выводим текст
		imagestring($dest, $size, $x_text-1, $y_text-1, $im_title, $white-$color);
		imagestring($dest, $size, $x_text+1, $y_text+1, $im_title, $white-$color);
		imagestring($dest, $size, $x_text+1, $y_text-1, $im_title, $white-$color);
		imagestring($dest, $size, $x_text-1, $y_text+1, $im_title, $white-$color);
		imagestring($dest, $size, $x_text-1, $y_text, $im_title, $white-$color);
		imagestring($dest, $size, $x_text+1, $y_text, $im_title, $white-$color);
		imagestring($dest, $size, $x_text, $y_text-1, $im_title, $white-$color);
		imagestring($dest, $size, $x_text, $y_text+1, $im_title, $white-$color);
		imagestring($dest, $size, $x_text, $y_text, $im_title, $color);
	}
	header("Content-Type: image/jpeg");
	imagejpeg($dest);
	imagedestroy($dest); 
	imagedestroy($im); 
}else{ echo 'Error';}

?>