Public feed #602256

FrozenFire89

public php v1 · immutable
Raw Edit
·published 2007-07-03 23:49 UTC
rendered paste body
<?phpswitch(isset($_POST['analyze'])) {case true:	$filename = $_FILES['image']['name'];	$filetmpname = $_FILES['image']['tmp_name'];	$image=@imagecreatefrompng($filetmpname);	if(!$image) die("Image creation failed horribly");	$black=imagecolorallocate($image, 0, 0, 0);	$white=imagecolorallocate($image, 255, 255, 255);	$x=imagesx($image);	$y=imagesy($image);	$offset=0;	$asciilist=array();	for($sy=0; $sy<$y; $sy++) {		for($sx=0; $sx<$x; $sx++) {			$cindex=imagecolorat($image, $x, $y);			if($cindex=$white) {				array_push($asciilist, $offset);				$offset=0;			} else $offset++;		}	}	array_walk($asciilist, 'echo');	break;case false:?><form method="POST" enctype="multitype/form-data"><input type="hidden" name="MAX_FILE_SIZE" value="1000000">file: <input type="file" name="image"><br><input type="submit" name="analyze" value="Analyze It!"></form><?php	break;}?>