te l'ho cambiato così crea un rettangolo verde e un bordo, puoi impostare l'altezza la larghezza e il bordo, le righe che ho cambiato ho messo un commentino aggiunto così si capisce meglio
Codice PHP:
<?php
// Set the content-type
header("Content-type: image/png");
$width=400;//aggiunto da nivasio :9
$height=30;//aggiunto da nivasio :9
// Create the image
$im = imagecreatetruecolor($width, $height);//aggiunto da nivasio :9
// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
$verde = imagecolorallocate($im, 0, 255, 0); //aggiunto da nivasio :9
// The text to draw
$text = 'testo di prova';
// Replace path by your own font path
$font = 'comic.ttf';
$bordo=3;//aggiunto da nivasio :9
ImageFilledRectangle($im,$bordo-1, $bordo-1, $width-$bordo, $height-$bordo, $verde); //aggiunto da nivasio :9
// Add some shadow to the text
imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);
// Add the text
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);
// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?>