PHP код:
<?php
$text = (isset($_GET['text']) && !empty($_GET['text']))? $_GET['text']: '';
$size = array('x' => (isset($_GET['x']) && !empty($_GET['x']))? intval($_GET['x']): 100,
'y' => (isset($_GET['y']) && !empty($_GET['y']))? intval($_GET['y']): 100
);
$image = loadPng('/home/bobo/public_html/button.png');
if(!$image) return;
imagecolorallocate($image, 220, 210, 60);
$txt_color = imagecolorallocate($image, 0, 0, 0);
$px = floor(($size['x'] - 7.5 * strlen($text)) / 2);
header('Content-type: image/png');
imagestring ($image, 3, $px, 9, $text, $txt_color);
imagepng($image);
imagedestroy($image);
function loadPng ($pngpath) {
global $size;
$image = @imagecreatefrompng ($pngpath);
if (!$image) {
$image = imagecreate ($size['x'], $size['y']);
}
return $image;
}
?>