»
 

Go Back   ResellerRatings Store Ratings > ResellerRatings Forums > Tech Support

Reply
 
LinkBack Thread Tools Display Modes
Old 02-26-2004, 08:01 PM   #1 (permalink)
Registered User
 
cracked's Avatar
 
Join Date: Nov 2001
Location: NCSU @ Raleigh, NC
Posts: 1,390
cracked is on a distinguished road
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...

__________________
Duroo

Last edited by cracked; 02-27-2004 at 01:29 AM.
cracked is offline   Reply With Quote
Old 02-26-2004, 08:10 PM   #2 (permalink)
Registered User
 
golfcart's Avatar
 
Join Date: Oct 2001
Location: Michigan
Posts: 1,680
golfcart is on a distinguished road
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 02-26-2004, 08:13 PM   #3 (permalink)
Registered User
 
cracked's Avatar
 
Join Date: Nov 2001
Location: NCSU @ Raleigh, NC
Posts: 1,390
cracked is on a distinguished road
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.
__________________
Duroo
cracked is offline   Reply With Quote
Old 02-26-2004, 08:15 PM   #4 (permalink)
Registered User
 
golfcart's Avatar
 
Join Date: Oct 2001
Location: Michigan
Posts: 1,680
golfcart is on a distinguished road
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
Display Modes

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

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


Most Active Discussions

Recent Discussions

All times are GMT -6. The time now is 06:25 PM.