Re: How to create a button with a icon inside ?
| From: | Chris Lambert | Date: | Sun, 08 Jul 2001 17:43:58 +0000 |
| Subject: | Re: How to create a button with a icon inside ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-56783@lists.php.net to get a copy of this message | ||
<?
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 - cjlambert@home.com
|-> ICQ #: 16435685 - AIM: ClipperChris
`-> Cell: (401) 743-2786 - http://sms.clambert.org/
----- Original Message -----
From: Mauro Ferreira <mauroferreira@enersulnet.com.br>
Newsgroups: php.gtk
To: <php-gtk@lists.php.net>
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 !