I put this together - combining two of the examples and then generated the text dynamically. but, with this set up, i was able to get the transparent background working as well.
<?php
header('Content-type: image/png');
$im = imagecreatetruecolor(175, 15);
imagesavealpha($im, true);
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 150, 25, $black);
$trans_colour = imagecolorallocatealpha($im, 0, 0, 0, 127);
imagefill($im, 0, 0, $trans_colour);
$text = $_GET['text'];
$font = 'catriel regular.ttf';
imagettftext($im, 9, 0, 13, 16, $black, $font, $text);
imagettftext($im, 9, 0, 12, 15, $white, $font, $text);
imagepng($im);
imagedestroy($im);
?>