Location: PHPKode > scripts > Convertor text > to *.png > convertor-text-to-png/index.php
<?php
if (isset ($_GET['txt']))
		{
        	header("Content-type: image/png"); //Picture Format
			header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Consitnuously modified
			header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
			header("Pragma: no-cache"); // NO CACHE
			
			if (empty ($_GET['size']))
			{
				$h = 85;
			} else {
				$h = $_GET['size'] + 25;
			}
			if (empty ($_GET['width']))
			{
				$w = 500;
			} else {
				$w = $_GET['width'];
			}
            $bg = imagecreatetruecolor($w, $h);
			
			//This will make it transparent
			imagesavealpha($bg, true);			
			$trans_colour = imagecolorallocatealpha($bg, 255, 0, 0, 127);
			imagefill($bg, 0, 0, $trans_colour);
			
			//Text to be written
			if (empty ($_GET['txt']))
			{
				header ("refresh: 0; index.php?e=t");
			} else {
				$Text = $_GET['txt'];
				$Text = stripslashes($Text);
				$Text = strip_tags($Text);
				$Text = htmlspecialchars ($Text);
			}			
			//Color select
				//Default colors
			if ( $_GET['color'] != 'custom')
			{
				$black = imagecolorallocate($bg, 0,0,0);
				$white = imagecolorallocate($bg, 255, 255, 255);
				$red = imagecolorallocate($bg, 255,0,0);
				$grey = imagecolorallocate($bg, 128, 128, 128);	
				$green = imagecolorallocate($bg, 0,255,0);
				$yellow = imagecolorallocate($bg, 255,255,0);
				$blue = imagecolorallocate($bg, 0,0,255);
				$color = $$_GET['color'];
			} else {
				if (empty($_GET['red'])) { $red = 0;} else {	$red = $_GET['red']; }
				if (empty($_GET['green'])) { $green = 0;} else {	$green = $_GET['green']; }
				if (empty($_GET['blue'])) { $blue = 0;} else {	$red = $_GET['blue']; }

				$color = imagecolorallocate($bg, $red, $green, $blue);
			}
		
			//Select font
			$font = 'fonts/'.$_GET['font'].'.ttf';
			
			//Font size
			if (empty ($_GET['size']))
			{
				$fontsize = 60;
			} else {
				$fontsize = $_GET['size'];
			}
			$Xpos = $fontsize + 10;
			$Ypos = 15;
			$Rot = 0;
			imagettftext($bg, $fontsize, $Rot, $Ypos, $Xpos, $color, $font, $Text);
			
			//Create image
			imagepng($bg);
			
			//destroy image
			imagedestroy($bg);
		} else {
			include ("enter_field.php");
		}
?>
Return current item: Convertor text > to *.png