minimal2
03-02-2006, 16:29
krcze... a troche szybciej by sie nie dalo?
// Deklaracje zmiennych
$fontDir = 'fonts/';
$fontFiles = array('verdana.ttf', 'impact.ttf', 'comic.ttf', 'arial.ttf');
$string = $_GET["text"];
$r = $_GET["r"];
$g = $_GET["g"];
$b = $_GET["b"];
$width = strlen($string) * 15 + 10;
$height = 25;
// Przesłanie nagłówków
header('Content-type: image/'.$imgType);
$img = imagecreate($width, $height);
// Deklaracje kolorów
$back = imagecolorallocate ($img, 255, 255, 255);
$font = imagecolorallocate ($img, $r, $g, $b);
$dots = imagecolorallocate ($img, rand(0 , 255), rand(0 , 255), rand(0 , 255));
// Generator plam
$pts = array();
for($i = 0; $i < round($width / 1.5); $i++)
{
$x = rand(0, $width);
$y = rand(0, $height);
if(!in_array($x.'_'.$y, $pts))
{
imageellipse($img, $x, $y, rand(2, 4), rand(3, 6), $dots);
$pts[] = $x.'_'.$y;
}
else
{
$i--;
}
}
// Generator textu
for($i = 0; $i < strlen($string); $i++)
{
imagettftext($img, rand(14, 16), rand(-10, 10), rand(3, 5) + $i * 15, 20 + rand(-3, 3), $font, $fontDir.'/'.$fontFiles[rand(0, count($fontFiles) - 1)], $string{$i});
}
imagecolortransparent ($img, $back);
// Wysłanie i zniszczenie obrazka
imagepng($img);
imagepng($img, "email.png");
imagedestroy($img);
?>
GD Support_____________enabled
GD Version bundled______(2.0.28 compatible)
FreeType Support________enabled
FreeType Linkage________with TTF library
FreeType Version________1.5
T1Lib Support___________enabled
GIF Read Support________enabled
GIF Create Support_______enabled
JPG Support_____________enabled
PNG Support____________enabled
WBMP Support__________enabled
XBM Support___________enabled
GD Support____________enabled
GD Version bundled_____(2.0.28 compatible)
FreeType Support_______enabled
FreeType Linkage_______with freetype
FreeType Version_______2.1.9
GIF Read Support_______enabled
GIF Create Support______enabled
JPG Support____________enabled
PNG Support___________enabled
WBMP Support_________enabled
XBM Support__________enabled