Use PHP to draw a button that can replace text. <HR> you always spend a lot of time making some buttons. design a good button and use it all! <Br/> & nbsp; text can be changed at will! You always have to spend a lot of time making some buttons. design a good button and use it all!
Text can be changed at will!
Header ("Content-type: image/gif ");
If (! Isset ($ s) $ s = 11;
// Times. tif can be any font you like
$ Size = imagettfbbox ($ s, 0, "/fonts/TIMES. TTF", $ text );
// Set the length and width
$ Dx = abs ($ size [2]-$ size [0]);
$ Dy = abs ($ size [5]-$ size [3]);
$ Xpad = 9;
$ Ypad = 9;
$ Im = imagecreate ($ dx + $ xpad, $ dy + $ ypad );
// Set R, G, and B
$ Blue = ImageColorAllocate ($ im, 0x2c, 0x6D, 0xAF );
$ Black = ImageColorAllocate ($ im, 0, 0 );
$ White = ImageColorAllocate ($ im, 255,255,255 );
// Draw
ImageRectangle ($ im, $ dx + $ xpad-1, $ dy + $ ypad-1, $ black );
ImageRectangle ($ im, 0, 0, $ dx + $ xpad, $ dy + $ ypad, $ white );
ImageTTFText ($ im, $ s, 0, (int) ($ xpad/2) + 1, $ dy + (int) ($ ypad/2), $ black, "/fonts/TIMES. TTF ", $ text );
ImageTTFText ($ im, $ s, 0, (int) ($ xpad/2), $ dy + (int) ($ ypad/2)-1, $ white, "/fonts/TIMES. TTF ", $ text );
ImageGif ($ im );
ImageDestroy ($ im );
?>
It is important that you cannot add any HTML tag to this code, especially when Join!
Write the following code during the call:
S is the image size. text is the image text.
Give it a try!
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.