📄 17-1.php3
字号:
<?
/*
** GIF button
** Creates a graphical button based
** form variables.
*/
//set parameters if not given
if(!isset($ButtonWidth))
{
$ButtonWidth = 100;
}
if(!isset($ButtonHeight))
{
$ButtonHeight = 30;
}
if(!isset($ButtonLabel))
{
$ButtonLabel = "CLICK";
}
if(!isset($ButtonFont))
{
$ButtonFont = 5;
}
//create image and colors
$image = imagecreate($ButtonWidth, $ButtonHeight);
$colorBody = imagecolorallocate($image, 0x99, 0x99, 0x99);
$colorShadow = imagecolorallocate($image, 0x33, 0x33, 0x33);
$colorHighlight = imagecolorallocate($image, 0xCC, 0xCC, 0xCC);
//create body of button
imagefilledrectangle($image,
1, 1, $ButtonWidth-2, $ButtonHeight-2,
$colorBody);
//draw bottom shadow
imageline($image,
0, $ButtonHeight-1,
$ButtonWidth-1, $ButtonHeight-1,
$colorShadow);
//draw right shadow
imageline($image,
$ButtonWidth-1, 1,
$ButtonWidth-1, $ButtonHeight-1,
$colorShadow);
//draw top highlight
imageline($image,
0, 0,
$ButtonWidth-1, 0,
$colorHighlight);
//draw left highlight
imageline($image,
0, 0,
0, $ButtonHeight-2,
$colorHighlight);
//determine label size
$ButtonLabelHeight = imagefontheight($ButtonFont);
$ButtonLabelWidth = imagefontwidth($ButtonFont) *
strlen($ButtonLabel);
//determine label upper left corner
$ButtonLabelX = ($ButtonWidth - $ButtonLabelWidth)/2;
$ButtonLabelY = ($ButtonHeight - $ButtonLabelHeight)/2;
//draw label shadow
imagestring($image,
$ButtonFont,
$ButtonLabelX+1,
$ButtonLabelY+1,
$ButtonLabel,
$colorShadow);
//draw label
imagestring($image,
$ButtonFont,
$ButtonLabelX,
$ButtonLabelY,
$ButtonLabel,
$colorHighlight);
//output image
header("Content-type: image/gif");
imagegif($image);
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -