Quite simple really, if you're aware of how to use GD then it'll be a total breeze I'll start off assuming you don't though.
First you need to create an image canvas using gd and load your image:
CODE
$canvas = imagecreatefrompng('canvas_template.png');
Next you have to assign the text colour (can use integers as opposed to hexadecimal):
CODE
$red = imagecolorallocate($canvas, 0xFF, 0x00, 0x00);
Now the placing the text, for the sake of clarity variables assigned for each argument:
CODE
$font_size = 15;
$angle = 0;
$x_coord = 125;
$y_coord = 110;
$font = 'FreeSansBold.ttf';
$text = 'dynamic text';
imagettftext($canvas, $font_size, $angle, $x_coord, $y_coord, $red, $font, $text);
Then to output:
CODE
header('Content-type: image/png');
imagepng($canvas);
Destroy the image resource and free up memory:
CODE
imagedestroy($canvas);
For source, font and example, see here:
http://bread.zymic.com/examples/procedual/...mic_image_text/Links to functions used:
http://www.php.net/imagecreatefrompnghttp://www.php.net/imagecolorallocatehttp://www.php.net/imagettftexthttp://www.php.net/imagepnghttp://www.php.net/destroyimagehttp://www.php.net/header