1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

PHP CLASS:creat fun pixel robots

Discussion in 'PHP' started by astkboy2008, Dec 20, 2009.

  1. #1
    Need to represent data in an easy to digest fashion? Bored of Chernoff's faces? You need pixel robots! Use this class to create a PNG pixel robot of any size from three 8-bit values.
    Example usage
    
    <?php
      header('Content-type: image/png');
    
      require_once('class.pixelrobot.php');
    
      $robot = new pixelRobot();
      $robot->setData(1,128,255);
      $robot->setSize(6);
      $robot->renderPNG();
    ?>
    
    PHP:
    Sample outputs

    Adjusting the output size:
    [​IMG]
    Low to high values for head, body and feet:
    [​IMG]

    Things we should probably add
    • Other image output formats
    • Images to file system
    • ASCII output
    • Better color controls
    • PHP script for inline image attributes
    • jQuery plugin for attributes
    downloads
    phppixelrobot-1.0.zip [1.39 KB]
    or see the class contents
    class.pixelrobots.php [4.09 KB]
     
    astkboy2008, Dec 20, 2009 IP