[42] | 1 | <?php // content="text/plain; charset=utf-8" |
---|
| 2 | // Change this defines to where Your fonts are stored |
---|
| 3 | DEFINE("TTF_DIR","/usr/share/fonts/truetype/"); |
---|
| 4 | |
---|
| 5 | // Change this define to a font file that You know that You have |
---|
| 6 | DEFINE("TTF_FONTFILE","arial.ttf"); |
---|
| 7 | |
---|
| 8 | // Text to display |
---|
| 9 | DEFINE("TTF_TEXT","Hello World!"); |
---|
| 10 | |
---|
| 11 | $im = imagecreatetruecolor (400, 100); |
---|
| 12 | $white = imagecolorallocate ($im, 255, 255, 255); |
---|
| 13 | $black = imagecolorallocate ($im, 0, 0, 0); |
---|
| 14 | $border_color = imagecolorallocate ($im, 50, 50, 50); |
---|
| 15 | |
---|
| 16 | imagefilledrectangle($im,0,0,399,99,$white); |
---|
| 17 | imagerectangle($im,0,0,399,99,$border_color); |
---|
| 18 | imagettftext ($im, 30, 0, 90, 60, $black, TTF_DIR.TTF_FONTFILE,TTF_TEXT); |
---|
| 19 | |
---|
| 20 | header ("Content-type: image/png"); |
---|
| 21 | imagepng ($im); |
---|
| 22 | ?> |
---|