Code: Select all
<?php
//post headers. Tells client file is type gif
header("Content-type: image/jpeg");
//load in the text using GET. 'text' is a variable in the GET method
$string = $_GET['text'];
$string2 = $_GET['text2'];
//Load the image
$im = imagecreatefromjpeg("riots.jpg");
//make a variable to set the text color
$blue = imagecolorallocate($im, 0x78, 0x74, 0x8f);
$red = imagecolorallocate($im, 0xaf, 0x33, 0x3c);
//load the font
$font = 'gf.ttf';
$font2 = 'ang.ttf';
//draw the text onto the image
imagettftext($im, 20, 0, 110, 680, $blue, $font, $string);
imagettftext($im, 210, 0, 50, 600, $red, $font2, $string2);
//print the image
imagegif($im);
//delete the evidence
imagedestroy($im);
?>