<?
Header("Content-type: image/png");
$font = "php.ttf";
if(!$si) $si = 66;
$im = ImageCreateFromPNG("php-blank.png");
$tsize = imagettfbbox($si,0,$font,$text);
$dx = abs($tsize[2]-$tsize[0]);
$dy = abs($tsize[5]-$tsize[3]);
$x = ( imagesx($im) - $dx ) / 2;
$y = ( imagesy($im) - $dy ) / 2 + 3*$dy/4;
$blue = ImageColorAllocate($im,0x5B,0x69,0xA6);
$white = ImageColorAllocate($im,255,255,255);
$black = ImageColorAllocate($im,0,0,0);
ImageTTFText($im, $si, 0, $x, $y, $white, $font, $text);
ImageTTFText($im, $si, 0, $x+2, $y, $white, $font, $text);
ImageTTFText($im, $si, 0, $x, $y+2, $white, $font, $text);
ImageTTFText($im, $si, 0, $x+2, $y+2, $white, $font, $text);
ImageTTFText($im, $si, 0, $x+1, $y+1, $black, $font, $text);
ImagePNG($im);
?>
...from one of the PHP conferences.
"php.ttf" is the font
"php-blank.png" is the base image
$text is the text you want to write, and $si is the size of the font
______________________________
/ Chris Lambert - [EMAIL PROTECTED]
|-> ICQ #: 16435685 - AIM: ClipperChris
`-> Cell: (401) 743-2786 - http://sms.clambert.org/
----- Original Message -----
From: Mauro Ferreira <[EMAIL PROTECTED]>
Newsgroups: php.gtk
To: <[EMAIL PROTECTED]>
Sent: Sunday, July 08, 2001 1:10 PM
Subject: How to create a button with a icon inside ?
Can someone show me a example ?
I'm doing some refinements in an database-oriented app, and show database
navigation and action buttons with small icons instead of text will do a lot
for the visual - and cuts a lot in internationalization too !
If isn't ask for too much, a example of a combined icon+text button too will
be great too - some not-so-obvious actions, like data integrity check need a
text anyway.
Know how to make this will simplify my work a lot, not to mention the visual
aspect.
Thanks !
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]