[Fixed] My for loop hates me :(

Discussion in 'PHP' started by . Jordan ., Jul 16, 2010.

  1. #1
    EDIT: Never mind. Fixed now :p
     
    . Jordan ., Jul 16, 2010 IP
  2. Deacalion

    Deacalion Peon

    Messages:
    438
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    
    <?php
        header('Content-type: image/jpeg');
    
        $image = imagecreatetruecolor(200, 200);
    
        $white = imagecolorallocate($image, 255, 255, 255);
        $black = imagecolorallocate($image, 0, 0, 0);
    
        // columns
        for($i = 0; $i != 200; $i++)
            // rows
            for ($j = 0; $j != 200;$j++)
                imagesetpixel($image, $i, $j, (rand(0, 1)) ? $black : $white);
    
        imagejpeg($image);
    ?>
    
    PHP:
     
    Deacalion, Jul 16, 2010 IP
  3. Deacalion

    Deacalion Peon

    Messages:
    438
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #3
    fast :)... I like the idea of this lil thing, lol
     
    Deacalion, Jul 16, 2010 IP
  4. . Jordan .

    . Jordan . Guest

    Messages:
    51
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yeahh I looked back at my code after threading this and was like "What the fuck am I using those arrays for" lol

    got it all working here now though :D

    jordan-adams.co.uk/work/php/random/noise-gen
     
    . Jordan ., Jul 16, 2010 IP