andy's php projects
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Script and site usage:
All of the scripts on this site are provided free for non-commerical, personal or non-profit use. If you find these scripts useful to you, appreciate the free support, or are just an all round nice person, then why not donate a little dosh? If you wish to use any of these in a commercial system, please refer to the payment plan.


Picture from table

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> Image Functions
View previous topic :: View next topic  
Author Message
pontusuggla
Newbie


Joined: 18 Dec 2004
Posts: 1

PostPosted: Sat Dec 18, 2004 5:43 pm    Post subject: Picture from table Reply with quote

Here is something I did after learning about the function that reads the color of a picture:

http://www.acrobalance.com/table.php

And here is the code:

[php]

<img src='bilder/lila_svep-800.jpg' border=0>
<table cellpadding=0 cellspacing=0 border=0>
<?php

include("admin/class.image.php");

$img = imagecreatefromjpeg("bilder/lila_svep-800.jpg");
for($row = 1; $row < 315; $row = $row + 15) {
echo("<tr>\r\n");
for($i = 0; $i < 800; $i = $i + 15) {
echo("<td width=15 height=15 bgcolor='" . Image::rgb2hex(Image::getPixelRGB($img, $i, $row)) . "'><img src='/bilder/spacer.gif' height=15 width=15 border=0></td>\r\n");
}
echo("</tr>\r\n");
}
?>
</table>
Back to top
View user's profile Send private message
amnuts
Site Admin


Joined: 01 Sep 2002
Posts: 662
Location: East Sussex, England

PostPosted: Sun Dec 19, 2004 8:36 am    Post subject: Reply with quote

Hi there - welcome to the board!

Great job on the implementation! Looks really good. Smile

Andy
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Endat
Newbie


Joined: 20 Feb 2006
Posts: 2

PostPosted: Mon Feb 20, 2006 12:35 am    Post subject: Reply with quote

Here is a similar code Smile http://www.picturesloaded.com/test3.php
If you think its the actual image, look again... its a huge table with each column 1x1 colored to represent 1 pixel of the following image: http://www.picturesloaded.com/untitled5.bmp
it does appear upside down because thats how the bitmap format is... in reverse.


$x = 0;
$y = $biHeight-1;
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#000000\"><tr>";
foreach ($thePicture as $pixel)
{
$colR[] = hexdec($pixel);
if (count($colR) == 3):
$r = dechex($colR[2]);
if (strlen($r) < 2)$r="0".$r;
$g = dechex($colR[1]);
if (strlen($g) < 2)$g="0".$g;
$b = dechex($colR[0]);
if (strlen($b) < 2)$b="0".$b;
$supermonkey = "#".$r.$g.$b;
#imagesetpixel($image, $x, $y, $supermonkey);

echo "<td bgcolor=\"$supermonkey\" height=\"1\" width=\"1\"><img src=\"images/spacer.gif\" width=\"1\" height=\"1\"></td>";
unset($supermonkey);
unset($colR);
$x++;
if ($x > $biWidth):
$x = 1;
$y -= 1;
echo "</tr><tr>";
endif;
endif;
}
echo "</tr></table>";
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> Image Functions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group