You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.3 KiB
61 lines
1.3 KiB
<?php
|
|
header("Content-type: image/gif");
|
|
|
|
$width = 110;
|
|
$height = 24;
|
|
$font = 2;
|
|
if(!isset($label)) { $label="Click Me!"; }
|
|
|
|
$image = imagecreate($width,$height);
|
|
|
|
// set up the image colors
|
|
$body = imagecolorallocate($image, 0xCC, 0xCC, 0xCC);
|
|
$shadow = imagecolorallocate($image, 0x99, 0x99, 0x99);
|
|
$light = imagecolorallocate($image, 0xE0, 0xE0, 0xE0);
|
|
$text = imagecolorallocate($image, 0x00, 0x00, 0x00);
|
|
|
|
// draw button body
|
|
imagefilledrectangle($image,
|
|
1,1,
|
|
$width-2,$height-2,
|
|
$body);
|
|
// draw bottom shadow
|
|
imageline($image,
|
|
0,$height-1,
|
|
$width-1,$height-1,
|
|
$shadow);
|
|
// draw right shadow
|
|
imageline($image,
|
|
$width-1,1,
|
|
$width-1,$height-1,
|
|
$shadow);
|
|
// draw top highlight
|
|
imageline($image,
|
|
0, 0,
|
|
$width-1, 0,
|
|
$light);
|
|
// draw left highlight
|
|
imageline($image,
|
|
0, 0,
|
|
0, $height-2,
|
|
$light);
|
|
|
|
// calculate label size
|
|
$labelheight = imagefontheight($font);
|
|
$labelwidth = imagefontwidth($font) * strlen($label);
|
|
|
|
// calculate label position
|
|
$labelx = ($width - $labelwidth)/2;
|
|
$labely = ($height - $labelheight)/2;
|
|
|
|
// draw label offset
|
|
// imagestring($image,$font,$labelx+1,$labely+1,$label,$shadow);
|
|
|
|
// draw label
|
|
imagestring($image,$font,$labelx,$labely,$label,$text);
|
|
|
|
// output the image
|
|
header("Content-type: image/gif");
|
|
imagegif($image);
|
|
|
|
?>
|