|
|
<?php header("Content-type: image/gif");
$width = 30; $height = 16; $font = 1; 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, 0x33, 0x33, 0x33);
// 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);
?>
|