PDA

View Full Version : Picture making script



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).

?>

tech_support
11-21-2007, 06:08 AM
Not working.

Master_script_maker
11-21-2007, 12:21 PM
what's not working. the site or the code?

BLiZZaRD
11-21-2007, 02:35 PM
Either.. both? The site is up, the code is there, when you type in text, pick your colors and hit submit, you get a string of letters and what appears to be wingdings.

boogyman
11-21-2007, 04:33 PM
A script that turns text into a picture! PHP 4 compatible

support for PHP 4 will be ending shortly on php.net that is.



Today it is exactly three years ago since PHP 5 has been released. In those three years it has seen many improvements over PHP 4. PHP 5 is fast, stable & production-ready and as PHP 6 is on the way, PHP 4 will be discontinued.

The PHP development team hereby announces that support for PHP 4 will continue until the end of this year only. After 2007-12-31 there will be no more releases of PHP 4.4. We will continue to make critical security fixes available on a case-by-case basis until 2008-08-08. Please use the rest of this year to make your application suitable to run on PHP 5.

Master_script_maker
11-21-2007, 06:27 PM
support for PHP 4 will be ending shortly on php.net that is.
works in PHP 5 too

BLiZZaRD
11-21-2007, 06:36 PM
Errr.. no it doesn't... Here is a screen of the output... that is anything but a picture...

Master_script_maker
11-21-2007, 06:39 PM
Errr.. no it doesn't... Here is a screen of the output... that is anything but a picture...
I fixed it now

BLiZZaRD
11-21-2007, 06:51 PM
That's better. Did you adjust your code in the first post?

Master_script_maker
11-21-2007, 07:00 PM
yes i added

header("Content-type: image/png"); // Tell the browser it's an image
i forgot it. a stupid mistake :(