Просмотр поста

.
Tester
BupTyo3 (02.08.2010/12:46)
В коде страницы практически ничего нет.только запрос который создает массив $res и все.
Путь к файлу правильно указал?
этот говнокод вообще зачем использовать?
$format = format($infile);
Вот так вот у меня
$file = isset ($_GET['file']) ? htmlspecialchars(urldecode($_GET['file'])) : NULL;
	
	if ($file && file_exists('screen/' . $file)) {
		$img = 'screen/' . $file;
		$info = getimagesize('screen/' . $file);
		$type = $info['mime'];
		$razm = 150;
        $width = $info[0];
        $height = $info[1];
        $x_ratio = $razm / $width;
        $y_ratio = $razm / $height;
        if (($width <= $razm) && ($height <= $razm)) {
            $tn_width = $width;
            $tn_height = $height;
        }
        else
            if (($x_ratio * $height) < $razm) {
                $tn_height = ceil($x_ratio * $height);
                $tn_width = $razm;
            }
            else {
                $tn_width = ceil($y_ratio * $width);
                $tn_height = $razm;
        }
		switch($type)
		{
			//здесь добавляем нужные мими типы case'image/gif' и т.д.
			case'image/png':
				$imc=ImageCreateFromPNG($img);
			break;
		}
		if($w < 100 && $h < 100)
		{
			$w_or = $w;
			$h_or = $h;
		}
		else
		{
			$k = ($w > $h) ? $w/100 : $h/100;

			$w_or = round($w/$k);
			$h_or = round($h/$k);
		}
		$copy = true;

		$img = imagecreatetruecolor($tn_width, $tn_height);

		imagecopyresized($img,$imc, 0, 0, 0, 0, $tn_width, $tn_height, $width, $height);
		$site_home = 'site.net'; //сайт или слово для копирайта
$height_text = 11; //Высота шрифта
		$naklon = 55; //Наклон шрифта
		
		if($copy)
			imagettftext($img, $height_text, $naklon, ceil($width*0.05), ceil($height*0.9), ImageColorAllocate($img, 0, 0, 0), 'STENCIL.TTF', $site_home);
		//Используется шрифт STENCIL.TTF разумеется его надо добавить или свой добавить и изменить название выше
		ob_start();
        ImagePng($img);
		ImageDestroy($img);
        ImageDestroy($imc);
        header('Content-type: image/png');
		header('Content-Length: ' . ob_get_length());
        ob_end_flush();
	}

//Путь к файлу поменяй должно работать