<?php
$_GET['size'] = 26;
$_GET['text'] = "Button text";
$size = imagettfbbox($_GET['size'], 0, "ARIAL", $_GET['text']);
$xsize = abs($size[0]) + abs($size[2]);
$ysize = abs($size[5]) + abs($size[1]);
$image = imagecreatefrompng("button.png");
$imagesize = getimagesize("button.png");
$textleftpos = round(($imagesize[0] - $xsize) / 2);
$texttoppos = round(($imagesize[1] + $ysize) / 2);
$white = ImageColorAllocate($image, 255,255,255);
imagettftext($image, $_GET['size'], 0, $textleftpos, $texttoppos, $white, "ARIAL",
$_GET['text']);
header("content-type: image/png");
imagepng($image);
imagedestroy($image);
?>
|