1<?php
2header("Content-type: image/png");
3header("Expires: Mon, 01 Jul 2003 00:00:00 GMT");
4header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
5header("Cache-Control: no-cache, must-revalidate");
6header("Pragma: no-cache");
7
8/*image generation code*/
9$bg = imagecreatetruecolor(isset($_GET['text']) ? strlen($_GET['text'])*11 : 66, 15);
10
11//This will make it transparent
12imagesavealpha($bg, true);
13$trans_colour = imagecolorallocatealpha($bg, 0, 0, 0, 127);
14imagefill($bg, 0, 0, $trans_colour);
15
16//Text to be written
17$text = isset($_GET['text']) ? $_GET['text'] : "No Name";
18
19// Black Text
20$black = imagecolorallocate($bg, 0,0,0);
21
22$font = './DejaVuSans.ttf'; //path to font you want to use
23$fontsize = 10; //size of font
24
25//Writes text to the image using fonts using FreeType 2
26imagettftext($bg, $fontsize, 0, 10, 12, $black, $font, $text);
27
28//Create image
29imagepng($bg);
30
31//destroy image
32ImageDestroy($bg);
33?>
34