protected function addGifHeader()
    {
        if (ord($this->frames[0]{10}) & 0x80) {
            $cMap = 3 * (2 << (ord($this->frames[0]{10}) & 0x07));

            $this->gifData = 'GIF89a';
            $this->gifData .= substr($this->frames[0], 6, 7);
            $this->gifData .= substr($this->frames[0], 13, $cMap);
            $this->gifData .= "!\377\13NETSCAPE2.0\3\1".$this->getGifWord($this->loopCount)."\0";
        }
    }