note 32464 added to function.imagecolorat
| From: | php-general at lists dot php dot net | Date: | Wed, 28 May 2003 13:54:00 +0000 |
| Subject: | note 32464 added to function.imagecolorat | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-49174@lists.php.net to get a copy of this message | ||
Just for fun, here is a little snippet that "paints" a image in html only. Try it out with
very small images, as this is a real browser-killer. mozilla > 120mb ram, ie > 100mb with a
300x200 image :-)
$file = "image.png";
$im = imagecreatefrompng($file);
$size_arr = getimagesize($file);
echo "<table width=".$size_arr[0]." height=".$size_arr[1]."
cellpadding=0 cellspacing=0 border=0>";
for ($y=0; $y<$size_arr[1]; $y++) {
echo "<tr>";
for ($x=0; $x<$size_arr[0]; $x++) {
$rgb = ImageColorAt($im, $x, $y);
printf("<td width=1 bgcolor=%06x><img width=1></td>", $rgb);
}
echo "</tr>";
}
echo "</table>";
----
Manual Page -- http://www.php.net/manual/en/function.imagecolorat.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32464
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32464&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32464&report=yes