First thing I'd do: Add error checking:
<?php
//header("Content-type: image/jpeg");
// Move this to the bottom....
$id = imagecreatefromjpeg('kitten.jpeg');
$string = $_GET['text'];
$black = imagecolorallocate($id, 0, 0, 0);
// Check to see if the color allocation worked:
if($black == -1)
die('Error in color allocation.');
imagettftext ($id, 8, 0, 48, 311, $black, "font.ttf", $string);
// Now send the header:
header("Content-type: image/jpeg");
imagejpeg($id);
?>
See what that gives you...