hallo,
ich erstelle mit folgendem skript ein ein-pixel-bild :
<?php
class giffy
{
var $ini = '47494638396101000100f70000';
var $end;
var $nor = '2c000000000100010000080400010404003b';
var $inc = '21f90401000000002c000000000100010000080400010404003b';
var $color = '000000';
function giffy ()
{
$this->end = str_repeat('f', 1530);
}
function hex2bin($s)
{
$n = strlen($s);
if ($n % 2 != 0) { return FALSE; }
$t = "";
for ($x = 0; $x < $n; $x+=2)
{$t .= chr(hexdec($s[$x].$s[$x+1]));}
return $t;
}
function create ($incolor = 0)
{
$pix = $this->ini . $this->color. $this->end;
if ($incolor == 1)
{
$pix .= $this->inc;
} else {$pix .= $this->nor;}
return $this->hex2bin($pix);
}
}
class colgif extends giffy
{
function create($color, $incolor = 0)
{
$this->color = $color;
$gif = giffy::create($incolor);
return $gif;
}
}
$gifpix = new colgif();
header("Content-type: image/gif");
echo $gifpix->create($color);
?>
die klassen sind soweit klar. Also die daten werden nachher in der funktion hex2bin in binärcode umgewandelt , soweit so gut,
was bewirken nun die zahelnsequenzen am anfang , bzw. was bedeuten sie ? und wenn ich jetzt ein zwei-pixel-bild mit zwei verscheidenfarbigen pixeln erstellen will, wie mache ich das ?
danke für Eure Hilfe
gruss
Peter