KentonBomb
New Member
- Messages
- 42
- Reaction score
- 0
- Points
- 0
I'm going into hardcore PHP mode now. Since linux has taken my life over, I find web based scripting much more appealing that writing windows programs to use over Wine.
This is my latest PHP Creation. It's a random image generator.
	
	
	
		
		
		
			
		
		
	
	
		 
	
Refresh to see a new image.
This is the source:
	
	
	
		
As you can see, it reads the number of entries in a txt file named "random.txt". It dynamically generates the image based on the number of entries in the text file (Each entry is separated by a comma)
An example random.txt would be:
	
	
	
		
This would randomly say hello in a few different languages (Note:: I don't care if I spelled any of those incorrectly  )
)
Feedback?
			
			This is my latest PHP Creation. It's a random image generator.
Refresh to see a new image.
This is the source:
		PHP:
	
	<?php
/*
Random Textalizer
*/
$img = imagecreate(220, 20);
$black = imagecolorallocate($img, 0, 0, 0);
$white = imagecolorallocate($img, 255, 255, 255);
imagefill($img, 0, 0, $black);
$file = "random.txt";
$hnd = fopen($file, "r");
$strings = fread($hnd, filesize($file));
$array = explode(",", $strings);
$ret = count($array);
$num = rand(1, $ret);
$string = $array[$num];    
imagestring($img, 2, 2, 2, $string, $white);    
header("Content-type: image/png");
imagepng($img);
imagedestroy($img);
?>An example random.txt would be:
		Code:
	
	Hello!, Bon Jour, Hola!, Konnichiwa!, Ni Hao!Feedback?
 
				 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		