PHP Classes

File: Gifpix.class.php

Recommend this page to a friend!
  Classes of Bulent Tezcan   Html_graph.php   Gifpix.class.php   Download  
File: Gifpix.class.php
Role: ???
Content type: text/plain
Description: Gif image creation class
Class: Html_graph.php
Author: By
Last change:
Date: 22 years ago
Size: 1,160 bytes
 

Contents

Class file image Download
<?PHP // Class GifPix and Function Hex2Bin // By Roberto Bertó <berto@que.com.br> under GPL license. // Free like Linux! /** * A class to create 1x1 size gif image without GD. * @author Roberto Bertó */ class Gifpix { // PRIVATE VARS var $ini = '47494638396101000100f70000'; var $end; var $nor = '2c000000000100010000080400010404003b'; var $inc = '21f90401000000002c000000000100010000080400010404003b'; /** * Constructor of the class Gifpix. * @public * @returns void */ function gifpix () { $this->end = str_repeat('f',1530); } /** * Internal function. * @private * @returns string */ function hex2bin ($s) { $n = strlen($s); if ($n % 2 != 0) { return FALSE; } $t = ""; for ($x = 1; $x <= $n/2; $x++) { $t .= chr(hexdec(substr($s,2* $x - 2,2))); } return $t; } /** * function to create the image. * @public * @returns string */ function create ($color,$incolor = 0) { $hex = $this->ini; $hex .= $color; $hex .= $this->end; if ($incolor == 1) { $hex .= $this->inc; } else { $hex .= $this->nor; } return $this->hex2bin($hex); } } ?>