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

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

$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 = $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 ($new_w >= '60' or $new_h >= '60'){
	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); 
	//imagedestroy($wat);	
}
else echo 'Error';

?>