Un buen y sencillo código para crear botones estilo web 2.0 con Imagick.

<?php
// Se crea el objeto Imagick
$im = new Imagick();
// Se crea un canvas vacio
$im->newImage( 200, 200, "white", "png" );
// Se crea el objeto para dibujar
$draw = new ImagickDraw();
// Color del botón
$draw->setFillColor( "#4096EE" );
// Se crea el cÃrculo exterior
$draw->circle( 50, 50, 70, 70 );
// Se crea el ciruclo transparente de la zona inferior
$draw->setFillColor( "white" );
// Color semi transparente
$draw->setFillAlpha( 0.2 );
// Se dibuja el cÃrculo
$draw->circle( 50, 50, 68, 68 );
// Se indica la fuente
$draw->setFont( "./test1.ttf" );
// Se crea el reflejo superior
$draw->setFillAlpha( 0.17 );
// Se dibuja la curva
$draw->bezier( array(
array( "x" => 10 , "y" => 25 ),
array( "x" => 39, "y" => 49 ),
array( "x" => 60, "y" => 55 ),
array( "x" => 75, "y" => 70 ),
array( "x" => 100, "y" => 70 ),
array( "x" => 100, "y" => 10 ),
) );
// Se dibuja la imagen
$im->drawImage( $draw );
// Se pone a opaco para el texto
$draw->setFillAlpha( 1 );
// Tamaño de la letra
$draw->setFontSize( 30 );
// Color del texto
$draw->setFillColor( "white" );
// Se escribe el texto
$im->annotateImage( $draw, 38, 55, 0, "go" );
// Se recorta la imagen
$im->trimImage( 0 );
// Se envÃa la imagen
header( "Content-Type: image/png" );
echo $im;
?>
Siempre que se hace este tipo de scripts en nuestras aplicaciones web, hay que recordar que Imagick consume muchos recurosos.
Creating buttons with Imagick
Eso es porqué en PHP, al igual que otros muchos lenguajes dinámicos, las funciones son elementos de primer orden.