PX : code

GIF Button by Rasmus Lerdorf
Rating: 5.00
Download this code


/* Include the following function in your script: */

   function button($text) {
      $enc_text = urlencode($text);                      
      echo "<img src="button.php3?$enc_text" border=0 Alt="$text">";
  }


/* Then create a button.php3 which contains: */

<?
        Header("Content-type: image/gif");
        $string=implode($argv," ");
        $im = imagecreatefromgif("/button1.gif");
        $orange = ImageColorAllocate($im, 220, 210, 60);
        $px = (imagesx($im)-7.5*strlen($string))/2;
        ImageString($im,3,$px,9,$string,$orange);
        ImageGif($im);
        ImageDestroy($im);
?>

/* 

button1.gif is a 135x40 GIF background for the button.  I use a dark blue
background with bevelled edges and as the above example reflects, orange
text.  Experiment with the colours and the sizing algorithm if you change
the background image size.  You should also change the path to the
button1.gif image to reflect where you have your images within your web
tree.

button1.gif is available at
http://px.sklar.com/files/graphics/button1.gif

*/

Comments or questions?
PX is running PHP 5.2.17
Thanks to Miranda Productions for hosting and bandwidth.
Use of any code from PX is at your own risk.