Помогите как сделать прозрачным задний фон этой капчи Код (PHP): session_start(); $n1 = rand(1000, 9999); $n2 = rand(1000, 9999); $_SESSION['rand_code'] = $n1 + $n2; // Записываем их сумму в сессию $dir = "fonts/"; $im = imagecreatetruecolor(90, 25); // Создаём изображение $color = imagecolorallocate($im, 0,0,0); // Задаём 1-й цвет $white = imagecolorallocate($im, 255,255,255); // Задаём 2-й цвет //imagefill($im, 10, 10, $white); imagefilledrectangle($im, 0, 0, 399, 127, $white); // Делаем капчу с белым фоном imagettftext($im, 14, 0, 5, 19, $color, $dir."Alt_integre.ttf", "$n1 + $n2"); // Пишем текст header("Content-type: image/png"); // Отсылаем заголовок о том, что это изображение png imagepng($im); // Выводим изображение
google: php gd transparent background http://stackoverflow.com/a/15246907 Код (PHP): <?php $image = imagecreatetruecolor(100, 100); // Transparent Background imagealphablending($image, false); $transparency = imagecolorallocatealpha($image, 0, 0, 0, 127); imagefill($image, 0, 0, $transparency); imagesavealpha($image, true); // Drawing over $black = imagecolorallocate($image, 0, 0, 0); imagefilledrectangle($image, 25, 25, 75, 75, $black); header('Content-Type: image/png'); imagepng($image);