PHPBuilder - Matrix Binary JPEG Generator



RSS Twitter
Snippets Graphics

Matrix Binary JPEG Generator

by: cjpbob
|
July 26, 2002

Version: 1.1

Type: Full Script

Category: Graphics

License: GNU General Public License

Description: A script that generates a random image in the Matrix Binary style. All aspects of the image generation can be defined through the built in script interface, including: Digit Color Backround Color Image Resolution Unoccupied Space Font Style Additional Chars. See working Script at http://delta.glypto.com/~cjpbob/imgtext.php



<html>
<head>
<title>Matrix Dynamic Backround Binary Generator Deluxe 98 v9.6T (MDBBGD98v96T)</title>
</head>
<body>
<body bgcolor="#000000">
<font color="#888888">
<BODY LINK="#aaaaaa">    
<BODY VLINK="#aaaaaa">  
<body alink="#666666"> 
<? 
if ($_POST["submit"]){
$xmax=$_POST["xmax"];
$ymax=$_POST["ymax"];
$x=0;
$y=0;
$size=$_POST["size"];
$im = imagecreate ($xmax,$ymax);
$red=imagecolorallocate ($im, 255, 100, 100);
$color = imagecolorallocate ($im, $_POST["red"], $_POST["green"], $_POST["blue"]);
$backround = imagecolorallocate ($im, $_POST["redb"], $_POST["greenb"], $_POST["blueb"]);
$trichar=$_POST["trichar"];
imagefill($im, 1, 1, $backround);
while ($x<$xmax){
if ($_POST["density"]<2){$_POST["density"]=1;}
$bin=rand(0,$_POST["density"]);
if ($_POST["trichar"]=="cjpbob"){$trichar="";}
if ($bin==2){$bin=$trichar;}
if ($bin>2){$bin=" ";}

imagechar ($im,$size,$x,$y,$bin,$color);
$x=$x+20;
if ($x>$xmax-20)
{ 
$x=0;
$y=$y+15;
		if ($_POST["fades"]=="fadew"){
		$_POST["red"]=$_POST["red"]+$_POST["fadespeedw"];
						if ($_POST["red"]>255){$_POST["red"]=255;}
		$_POST["green"]=$_POST["green"]+$_POST["fadespeedw"];
				    if ($_POST["green"]>255){$_POST["green"]=255;}
		$_POST["blue"]=$_POST["blue"]+$_POST["fadespeedw"];
		        if ($_POST["blue"]>255){$_POST["blue"]=255;}
		$color = imagecolorallocate ($im, $_POST["red"], $_POST["green"], $_POST["blue"]);}
		
		if ($_POST["fades"]=="fade"){
		$_POST["red"]=$_POST["red"]-$_POST["fadespeed"];
						if ($_POST["red"]<0){$_POST["red"]=0;}
		$_POST["green"]=$_POST["green"]-$_POST["fadespeed"];
				    if ($_POST["green"]<0){$_POST["green"]=0;}
		$_POST["blue"]=$_POST["blue"]-$_POST["fadespeed"];
		        if ($_POST["blue"]<0){$_POST["blue"]=0;}
		$color = imagecolorallocate ($im, $_POST["red"], $_POST["green"], $_POST["blue"]);}
				
		if ($_POST["fades"]=="fadeb"){
		$_POST["red"]=$_POST["red"]-$_POST["fadespeedb"];
						if ($_POST["red"]<$_POST["redb"]){$_POST["red"]=$_POST["redb"];}
		$_POST["green"]=$_POST["green"]-$_POST["fadespeedb"];
				    if ($_POST["green"]<$_POST["greenb"]){$_POST["green"]=$_POST["greenb"];}
		$_POST["blue"]=$_POST["blue"]-$_POST["fadespeedb"];
		        if ($_POST["blue"]<$_POST["blueb"]){$_POST["blue"]=$_POST["blueb"];}
		$color = imagecolorallocate ($im, $_POST["red"], $_POST["green"], $_POST["blue"]);}
}
if ($y>$ymax)
{$x=9000;}
}
if ($_POST["trichar"]=="cjpbob"){}else{
$c="c";$j="j";$p="p";$b="b";$o="o";
imagechar ($im,$size,$xmax-90,$ymax-20,$c,$red);
imagechar ($im,$size,$xmax-75,$ymax-20,$j,$red);
imagechar ($im,$size,$xmax-60,$ymax-20,$p,$red);
imagechar ($im,$size,$xmax-45,$ymax-20,$b,$red);
imagechar ($im,$size,$xmax-30,$ymax-20,$o,$red);
imagechar ($im,$size,$xmax-15,$ymax-20,$b,$red);}
imagejpeg($im, "images/imagetext.jpg", $_POST["quality"]);
ImageDestroy($im);
?><img src="images/imagetext.jpg"><?
}
?>
<form action="imgtext.php" method="POST">
<input type="text" name="xmax" value="640">Xsize:::(in pixels)<br>
<input type="text" name="ymax" value="480">Ysize:::(in pixels)<br>
<input type="text" name="red" value="0">Digit Red::(0-255)<br>
<input type="text" name="green" value="255">Digit Green::(0-255)<br>
<input type="text" name="blue" value="0">Digit Blue::(0-255)<br>
<input type="text" name="redb" value="0">Backround Red::(0-255)<br>
<input type="text" name="greenb" value="0">Backround Green::(0-255)<br>
<input type="text" name="blueb" value="0">Backround Blue::(0-255)<br>
<input type="text" name="size" value="5">Digit Style(1-5)<br>
<input type="text" name="quality" value="40">Quality (Higher yeilds a larger file.)<br>
<input type="text" name="density" value="4">Data Sparity:::(amount of empty space)<br>
<input type="text" name="trichar" value="">Trinary Char.(if any)<br>
<input type="radio" name="fades" value="fade">Fade Digits to black---How Quickly?<input type="text" name="fadespeed" value="5"><br>
<input type="radio" name="fades" value="fadew">Fade Digits to white---How Quickly?<input type="text" name="fadespeedw" value="5"><br>
<input type="radio" name="fades" value="fadeb">Fade Digits to backround---How Quickly?<input type="text" name="fadespeedb" value="5"><font size=1>NOT PERFECT</font><br>
<input type="submit" name="submit" value="Make Image"><br>
</form>
<a href="index.php">Back to main</a>
</body>
</html>

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
cjpbob

Comment:



Comment:

(Maximum characters: 1200). You have characters left.