This example will create a round cornered button. And you need to make sure that ImageMagic is installed.
<?php
/* Create a new Imagick object */
$im = new Imagick();
/* Create empty canvas */
$im->newImage( 200, 200, "white", "png" );
/* Create the object used to draw */
$draw = new ImagickDraw();
/* Set the button color.
Changing this value changes the color of the button */
$draw->setFillColor( "#4096EE" );
/* Create a rectangle */
$draw->rectangle( 0, 0, 170, 40 );
/* Fill color */
$draw->setFillColor( "white" );
/* Semi-opaque fill */
$draw->setFillAlpha( 0.5 );
/* The font used for text */
$draw->setFont( "./Vera.ttf" );
/* This is the alpha value used to annotate */
$draw->setFillAlpha( 0.17 );
/* Draw a curve on the button with 17% opaque fill */
$draw->bezier( array(
array( "x" => 0 , "y" => 0 ),
array( "x" => 85, "y" => 24 ),
array( "x" => 170, "y" => 0 ),
) );
/* Render all pending operations on the image */
$im->drawImage( $draw );
/* Set fill to fully opaque */
$draw->setFillAlpha( 1 );
/* Set the font size to 30 */
$draw->setFontSize( 25 );
/* The text on the */
$draw->setFillColor( "white" );
/* Annotate the text */
$im->annotateImage( $draw, 38, 28, 0, "Submit" );
/* Trim extra area out of the image */
$im->trimImage( 0 );
/* Add round corners */
$im->roundCorners( 4, 4 );
/* Clone the current object */
$shadow = $im->clone();
/* Set the image background color to black (shadow color) */
$shadow->setImageBackgroundColor( new ImagickPixel('black') );
/* Create the shadow */
$shadow->shadowImage( 40, 1, 1, 1 );
/* Add the original image above */
$shadow->compositeImage( $im, Imagick::COMPOSITE_OVER, 0, 0 );
/* Output the image */
header( "Content-Type: image/png" );
echo $shadow;
?>
The effect is as follows:
And it's easy to change the font, color and size to fit your need.