<html>
<head>
<style>
.pixel {
width:1px;
height:1px;
float:left;
}
</style>
</head>
<body>
<?php
$f = dirname(__FILE__)."/tmp/igoogle.gif";
switch(strtolower(ereg_replace("^(.+)\.(.+)$","\\2",$f))) {
case "jpg": case "jpeg":
$i = imageCreateFromJpeg($f);
break 1;
case "gif":
$i = imageCreateFromGif($f);
break 1;
case "png":
$i = imageCreateFromPng($f);
break 1;
default:
die();
}
$s = getImageSize($f);
$width = $s[0];
$height = $s[1];
echo '<div style="width:'.$width.'px; height:'.$height.'px">';
for($y=0; $y<$height; $y++) {
for($x=0; $x<$width; $x++) {
$c = imageColorAt($i,$x,$y);
$c = imageColorsForIndex($i,$c);
echo '<div class="pixel" style="background-color:rgb('.$c["red"].','.$c["green"].','.$c["blue"].');"></div>';
}
}
echo '</div>';
?>
</body>
</html>