<html>
	<head>
		<title>Hello World!</title>
	</head>
	<body>

<?php
	class HelloWorld {
		public $iWidth = 0;
		public $iHeight = 0;
		public $oImage;
		
		function __construct() {
			list($iWidth, $iHeight, $sType, $aAttr) = getimagesize('helloworld.png');
			$this->oImage = imagecreatefrompng('helloworld.png');
			
			for ($y=1; $y < $iHeight; $y++) {
				echo '<div style="clear:both;width:' . $iWidth*2 . 'px;height:2px">';
				for ($x=1; $x < $iWidth; $x++) {
					$RGB = imagecolorat($this->oImage, $x, $y);
					$r = dechex(($RGB >> 16) & 0xFF);
					$g = dechex(($RGB >> 8) & 0xFF);
					$b = dechex($RGB & 0xFF);
					
					$r = strlen($r) < 2 ? '0' . $r : $r;
					$g = strlen($g) < 2 ? '0' . $g : $g;
					$b = strlen($b) < 2 ? '0' . $b : $b;
					$iHexRGB = $r . $g . $b;
					
					echo '<div style="float:left;width:2px;height:2px;background-color:#' . $iHexRGB . '"></div>';
				}
				echo '</div>';
			}
			imagedestroy($this->oImage);
		}

	}

	$oWorld = new HelloWorld();

?>
	</body>
</html>
