All pastes #420857 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-04-02 13:28 UTC
rendered paste body
<?php
	show_file(file('index.php'), 1);

	function show_file($input, $font){
		
		$longest = 0;
		$length = 0;
		foreach($input as $line){ 
			if(strlen($line) > $longest){
				$longest = strlen($line);
			}  
		}
		$l_height = (int)++imagefontheight($font);
		
		$doc_height = count($input) * $l_height;
		$doc_width = (int)++imagefontwidth($font);
		
		$im = imagecreate($doc_width, $doc_height);
		$black = imagecolorallocate($im, 0, 0, 0);
		
		$count = 0;
		foreach($input as $line){
			imagestring($im, $font, $count, 0, $line, $black);
			$count += ++$l_height;
		}
		
		header("Content-type: image/jpeg");
		imagejpeg($im);
	}
?>