Happy Codings - Programming Code Examples
Html Css Web Design Sample Codes CPlusPlus Programming Sample Codes JavaScript Programming Sample Codes C Programming Sample Codes CSharp Programming Sample Codes Java Programming Sample Codes Php Programming Sample Codes Visual Basic Programming Sample Codes


Php Programming Code Examples

Php > Graphics Code Examples

GifPix - create gif on the fly without GD

GifPix - create gif on the fly without GD <?php class gifpix { var $start = '47494638396101000100800000'; var $color = 'ffffff'; var $black = '000000'; var $marker = '21f904'; var $transparent = '01'; var $end = '000000002c00000000010001000002024401003b'; function hex2bin($s) { for ($i = 0; $i < strlen($s); $i += 2) { $bin .= chr(hexdec(substr($s,$i,2))); } return $bin; } function create($color = -1) { if (($color!= -1) && (strlen($color)==6)) { $this->transparent = '00'; if ($color == '000000') $this->black = 'ffffff'; $this->color = $color; } $hex = $this->start.$this->color.$this->black.$this->marker.$this->transparent.$this->end; return $this->hex2bin($hex); } } header("Content-Type: image/gif"); $gifpix = new gifpix(); // color: print $gifpix->create('0000ff'); // transparent: //print $gifpix->create(); ?>