Шустрый

Профиль
Группа: Участник
Сообщений: 138
Регистрация: 22.8.2008
Репутация: нет Всего: 2
|
Всем здравствуйте, я только вот начал учить php, помогите сделать счётчик посещений, счётчик, то работает, но вот картинка не выводится, то есть выводится вот такие символы | Код | 8^c`&,С@&2cЄЁd ЙP!“™P!“`– TM… ь H‚3“ „©М$PД8МbcЖ[6–ЌeЛZZҐХ‹z{л=угЅ~эє% чGЧлыоrѕп,чЬу н
|
Как сделать чтобы нормально выводилась графическая картинка. Вот код графическиго счётчика | Код | <?php
$count=0;
if (isset($_COOKIE['count'])) $count=$_COOKIE['count']; $count++; setcookie("count",$count,0x7FFFFFFF,"/");
function PrintChar( $hImage, $strChar, $x, $y, $nColor) { switch ($strChar) { case '0': imageline($hImage, $x, $y + 1, $x, $y + 4, $nColor); imageline($hImage, $x + 1, $y + 5, $x + 2, $y + 5, $nColor); imageline($hImage, $x + 3, $y + 4, $x + 3, $y + 1, $nColor); imageline($hImage, $x + 2, $y, $x + 1, $y, $nColor); break; case '1': imageline($hImage, $x + 2, $y, $x + 2, $y + 5, $nColor); imagesetpixel($hImage, $x + 1, $y + 1, $nColor); break; case '2': imagesetpixel($hImage, $x, $y + 1, $nColor); imageline($hImage, $x + 1, $y, $x + 2, $y, $nColor); imagesetpixel($hImage, $x + 3, $y + 1, $nColor); imageline($hImage, $x + 3, $y + 2, $x, $y + 5, $nColor); imageline($hImage, $x + 1, $y + 5, $x + 3, $y + 5, $nColor); break; case '3': imageline($hImage, $x, $y, $x + 3, $y, $nColor); imagesetpixel($hImage, $x + 3, $y + 1, $nColor); imageline($hImage, $x + 1, $y + 2, $x + 2, $y + 2, $nColor); imageline($hImage, $x + 3, $y + 3, $x + 3, $y + 4, $nColor); imageline($hImage, $x + 2, $y + 5, $x + 1, $y + 5, $nColor); imagesetpixel($hImage, $x, $y + 4, $nColor); break; case '4': imageline($hImage, $x + 2, $y + 4, $x, $y + 4, $nColor); imageline($hImage, $x, $y + 3, $x + 3, $y, $nColor); imageline($hImage, $x + 3, $y + 1, $x + 3, $y + 5, $nColor); break; case '5': imageline($hImage, $x + 3, $y, $x, $y, $nColor); imagesetpixel($hImage, $x, $y + 1, $nColor); imageline($hImage, $x, $y + 2, $x + 2, $y + 2, $nColor); imageline($hImage, $x + 3, $y + 3, $x + 3, $y + 4, $nColor); imageline($hImage, $x + 2, $y + 5, $x, $y + 5, $nColor); break; case '6': imageline($hImage, $x + 3, $y, $x + 1, $y, $nColor); imageline($hImage, $x, $y + 1, $x, $y + 4, $nColor); imageline($hImage, $x + 1, $y + 5, $x + 2, $y + 5, $nColor); imageline($hImage, $x + 3, $y + 4, $x + 3, $y + 3, $nColor); imageline($hImage, $x + 2, $y + 2, $x + 1, $y + 2, $nColor); break; case '7': imagesetpixel($hImage, $x, $y + 1, $nColor); imageline($hImage, $x, $y, $x + 3, $y, $nColor); imagesetpixel($hImage, $x + 3, $y + 1, $nColor); imageline($hImage, $x + 2, $y + 2, $x + 2, $y + 3, $nColor); imageline($hImage, $x + 1, $y + 4, $x + 1, $y + 5, $nColor); break; case '8': imagesetpixel($hImage, $x, $y + 1, $nColor); imageline($hImage, $x + 1, $y, $x + 2, $y, $nColor); imagesetpixel($hImage, $x + 3, $y + 1, $nColor); imageline($hImage, $x + 2, $y + 2, $x + 1, $y + 2, $nColor); imageline($hImage, $x, $y + 3, $x, $y + 4, $nColor); imageline($hImage, $x + 1, $y + 5, $x + 2, $y + 5, $nColor); imageline($hImage, $x + 3, $y + 4, $x + 3, $y + 3, $nColor); break; case '9': imageline($hImage, $x, $y + 5, $x + 2, $y + 5, $nColor); imageline($hImage, $x + 3, $y + 4, $x + 3, $y + 1, $nColor); imageline($hImage, $x + 2, $y, $x + 1, $y, $nColor); imageline($hImage, $x, $y + 1, $x, $y + 2, $nColor); imageline($hImage, $x + 1, $y + 3, $x + 2, $y + 3, $nColor); break; } return 5; }
function PrintLine( $hImage, $str, $x, $y, $nColor) { $nLength = strlen($str); for ($i = 0; $i < $nLength; $i++) $x += PrintChar($hImage, substr($str, $i, 1), $x, $y, $nColor); }
$hImage = imagecreatefrompng('lib_251_pic1.png'); header('Content-type: image/png'); echo PrintLine($hImage, $count, 10, 22, 0); imagepng($hImage);
?>
|
Помогите пожалуйста, за ранее спасибо Это сообщение отредактировал(а) AndreyZ53 - 19.2.2009, 11:07
--------------------
https://itbases.ru/
|