ciao ho questo codice... funziona benissimo... solo che il carattere ( Bodoni ) è "Bold", "Book" e "Italic" - io vorrei usare l'italic ma non so come fare... qualcuno può darmi una mano?
Codice PHP:
<?php
class titleImage {
var $font = 'Bodoni';
function titleImage($width='500',$height='60') {
$code = $_GET['titolo'];
/* font size will be 75% of the image height */
$font_size = 40;
$image = @imagecreate($width, $height) or die('Cannot initialize new GD image stream');
/* set the colours */
$background_color = imagecolorallocate($image, 255, 255, 255);
$text_color = imagecolorallocate($image, 210, 191, 154);
/* create textbox and add text */
$textbox = imagettfbbox($font_size, 0, $this->font, $code) or die('Error in imagettfbbox function');
$x = 0;
$y = ($height-20);
imagettftext($image, $font_size, 0, $x, $y, $text_color, $this->font , $code) or die('Error in imagettftext function');
/* output captcha image to browser */
header('Content-Type: image/jpeg');
imagejpeg($image);
imagedestroy($image);
}
}
$width = isset($_GET['width']) ? $_GET['width'] : '500';
$height = isset($_GET['height']) ? $_GET['height'] : '60';
$characters = isset($_GET['characters']) && $_GET['characters'] > 1 ? $_GET['characters'] : '4';
$captcha = new titleImage($width,$height);
?>