Master_script_maker
11-21-2007, 01:09 AM
A script that turns text into a picture! PHP 4 compatible. Many capabilities; hide e-mail from harvesters, make buttons, ect. check it out here. (http://masterproject.freehostia.com)
Here is the first html page code:
<html>
<head><title>Create a Picture</title>
</head>
<body>
<form method="get" action="createimagewtext.php">
Text In Picture:<input type="text" name="text"><br>
Backround color:
<select name="bg">
<option value="000,000,000">Black</option>
<option value="255,000,000">Red</option>
<option value="000,255,000">Green</option>
<option value="000,000,255">Blue</option>
<option value="255,255,000">Yellow</option>
<option value="000,000,255">Aqua</option>
<option value="255,000,255">Fuchsia</option>
<option value="192,192,192">Grey</option>
<option value="255,255,255" selected="selected">White</option>
</select>
Text Color:
<select name="te">
<option value="000,000,000" selected="selected">Black</option>
<option value="255,000,000">Red</option>
<option value="000,255,000">Green</option>
<option value="000,000,255">Blue</option>
<option value="255,255,000">Yellow</option>
<option value="000,255,255">Aqua</option>
<option value="255,000,255">Fuchsia</option>
<option value="192,192,192">Grey</option>
<option value="255,255,255">White</option>
</select><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
and here is the php code:
<?php
header("Content-type: image/png"); // Tell the browser it's an image,
$text = $_REQUEST["text"] ;
$bg = $_REQUEST["bg"] ;
$te = $_REQUEST["te"] ;
$bdc = explode(",",$bg);
$tec = explode(",",$te);
$number = strlen($text); // Count the chars in the text.
$number = ($number*7)+9; // Times this by 7 and add 9 to make it look the right size.
$im = imagecreate($number, 24); // Create the basic size, $number x 24
$colour1 = imagecolorallocate($im, $bdc[0], $bdc[1], $bdc[2]); // Background Color
$colour2 = imagecolorallocate($im, $tec[0], $tec[1], $tec[2]); // Text Color
imagestring($im, 3, 5, 5, $text, $colour2); // Add the text to the image.
imagepng($im); // Create and display the image.
imagedestroy($im); // Cast the image from the server (will cause lag eventually if you don't).
?>
Here is the first html page code:
<html>
<head><title>Create a Picture</title>
</head>
<body>
<form method="get" action="createimagewtext.php">
Text In Picture:<input type="text" name="text"><br>
Backround color:
<select name="bg">
<option value="000,000,000">Black</option>
<option value="255,000,000">Red</option>
<option value="000,255,000">Green</option>
<option value="000,000,255">Blue</option>
<option value="255,255,000">Yellow</option>
<option value="000,000,255">Aqua</option>
<option value="255,000,255">Fuchsia</option>
<option value="192,192,192">Grey</option>
<option value="255,255,255" selected="selected">White</option>
</select>
Text Color:
<select name="te">
<option value="000,000,000" selected="selected">Black</option>
<option value="255,000,000">Red</option>
<option value="000,255,000">Green</option>
<option value="000,000,255">Blue</option>
<option value="255,255,000">Yellow</option>
<option value="000,255,255">Aqua</option>
<option value="255,000,255">Fuchsia</option>
<option value="192,192,192">Grey</option>
<option value="255,255,255">White</option>
</select><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
and here is the php code:
<?php
header("Content-type: image/png"); // Tell the browser it's an image,
$text = $_REQUEST["text"] ;
$bg = $_REQUEST["bg"] ;
$te = $_REQUEST["te"] ;
$bdc = explode(",",$bg);
$tec = explode(",",$te);
$number = strlen($text); // Count the chars in the text.
$number = ($number*7)+9; // Times this by 7 and add 9 to make it look the right size.
$im = imagecreate($number, 24); // Create the basic size, $number x 24
$colour1 = imagecolorallocate($im, $bdc[0], $bdc[1], $bdc[2]); // Background Color
$colour2 = imagecolorallocate($im, $tec[0], $tec[1], $tec[2]); // Text Color
imagestring($im, 3, 5, 5, $text, $colour2); // Add the text to the image.
imagepng($im); // Create and display the image.
imagedestroy($im); // Cast the image from the server (will cause lag eventually if you don't).
?>