button.php <?php Header("Content-type: image/gif"); $string=str_replace("%20", " ", $string); $theimage = "images/" . $button .".gif"; $im = imageCreateFromgif($theimage); $white = ImageColorAllocate($im, 255, 255, 255);
$font = "/fonts/VERDANAB.TTF"; $box = imagettfbbox ( 12, 0, $font, $string); $th=$box[7]-$box[3]; $th= $th + 2; $py = (imagesy($im) -$th)/2; $px = (imagesx($im) -($box[2]-$box[0]))/2; $size = 12; ImageTTFText ($im, $size, 0, $px, $py, $white,$font,$string); Imagegif($im); ImageDestroy($im); ?> fot this to work you need to upload VERDANAB.TTF to a folder called 'fonts' and you call the image like this: to draw 'hello' on a button called 'mybutton.gif' stored in 'images' folder <img src="button.php?string=hello&button=mybutton"> ----- Original Message ----- From: "Rodrigo Peres" <[EMAIL PROTECTED]> To: "PHP" <[EMAIL PROTECTED]> Sent: Saturday, February 16, 2002 7:49 PM Subject: [PHP] Change gif image with php > Hi list > > I have some buttons made in photoshop in .gif format. This buttons have > round corner, feather, multiple colors etc. There's a way to open it with > php and write some text to it. I know that is possible to create images, but > what about to change them??? I need to do this because the text that will > fill the buttons come from mysql and change everyday. > > Thank's in advance > > > Rodrigo > > > ps: If someone want to see the button I'm talking look in > http://www.celebnet.com.br/home.php under the "AS ++". > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php