home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Join TechIMO for Free!
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
Reply Get bargains at  »  Dealighted.com
 
Thread Tools
Currently Active Users: 2022
Discussions: 188,394, Posts: 2,243,575, Members: 232,624
Old February 26th, 2004, 11:01 PM   Digg it!   #1 (permalink)
Ultimate Member
 
cracked's Avatar
 
Join Date: Nov 2001
Location: Winston-Salem, NC
Posts: 1,440
Send a message via AIM to cracked
PHP code not working

Quote:
<?

$im = ImageCreate(100,100);
for ($y = 0; $y <= 100; $y++) {
for ($x = 0; $x <= 100; $x++) {
$c1 = rand(1, 255);
$c2 = rand(1, 255);
$c3 = rand(1, 255);
$col = ImageColorAllocate($im, $c1, $c2, $c3);
ImageSetPixel ($im, $x, $y, $col);
}
}
ImagePNG ($im);

?>
its supposed to draw a 100x100 image and fill it with each pixel being a different, randomly generated color. but when i run it it gives you this the first few lines seem to be working but the rest is all the same color. this code is very simple and i can not for the life of me figure out why it isnt working. its nothing important, i was just screwing around, but i would like to know what im doing wrong. anybody see the problem?

thanks!

EDIT: i checked and it is only coloring 252 of the pixels and then leaving the rest the same color if that helps any...
__________________
Visit http://duroo.org


Last edited by cracked : February 27th, 2004 at 04:29 AM.
cracked is offline   Reply With Quote
Old February 26th, 2004, 11:10 PM     #2 (permalink)
Ultimate Member
 
golfcart's Avatar
 
Join Date: Oct 2001
Location: Michigan
Posts: 1,767
I'm no guru and the code looks good. I'm just curious as to what happens if you swap x and y in the "for" statements.

golfcart is offline   Reply With Quote
Old February 26th, 2004, 11:13 PM     #3 (permalink)
Ultimate Member
 
cracked's Avatar
 
Join Date: Nov 2001
Location: Winston-Salem, NC
Posts: 1,440
Send a message via AIM to cracked
tried it, all that does is make the couple rows that are working be vertical instead of horizontal. this is really starting to bug me bc i cant find any problems at all with the code.

cracked is offline   Reply With Quote
Old February 26th, 2004, 11:15 PM     #4 (permalink)
Ultimate Member
 
golfcart's Avatar
 
Join Date: Oct 2001
Location: Michigan
Posts: 1,767
That's what I figured, but it was worth a shot
golfcart is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Most Active Discussions
Is It Just Me? (2904)
Unarmed man on his stomach shot by .. (5)
New Build ( Finally ) (6)
Building a gaming computer advice (5)
Looks like Burris will get his Sena.. (12)
CPU wont boot (7)
I think I just killed my computer w.. (24)
Folderchat Weekday thread (444)
Upgrading RAM (6)
Recent Discussions
building a gaming computer, inp.. (0)
Iming and surfing slowed down (3)
Laptop proccesor to desktop mob.. (0)
Please help! multiple problems! (3)
Left 4 Dead Small Freezes (1)
Install Problem for Windows Def.. (1)
RCA 52Inch HDTV wont turn on (2)
nVidia GTX 295 now available (1)
Error ~ BAD BLOCK (19)
Blackberry Storm, Gears of War .. (1)
Core 2 Quad Q9550 system (3)
COWBOOM Ripoff! Used Laptop w/$.. (4)


All times are GMT -4. The time now is 02:03 AM.
TechIMO Copyright 2008 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28