Text Output using PHP

<?php

$image = imagecreate(400, 30);
$white = imagecolorallocate($image, 255, 255, 255);
$grey = imagecolorallocate($image, 128, 128, 128);
$black = imagecolorallocate($image,50,50,50);
imagefilledrectangle($image, 0, 0, 399, 29, $white);
$text = 'Welcome to my blog ';
$font = 'verdana.ttf';
imagettftext($image, 20, 0, 10, 20, $black, $font, $text);
header('Content-Type: image/png');
imagepng($image);
imagedestroy($image);

?> 

Output : Welcome to my blog 

Note : Include the 'verdana' font file in the same directory as that of the PHP script otherwise the script will not run.

Top