function GIFAddFrames ( $i, $d ) {

		$Locals_str = 13 + 3 * ( 2 << ( ord ( $this->BUF [ $i ] { 10 } ) & 0x07 ) );

		$Locals_end = strlen ( $this->BUF [ $i ] ) - $Locals_str - 1;
		$Locals_tmp = substr ( $this->BUF [ $i ], $Locals_str, $Locals_end );

		$Global_len = 2 << ( ord ( $this->BUF [ 0  ] { 10 } ) & 0x07 );
		$Locals_len = 2 << ( ord ( $this->BUF [ $i ] { 10 } ) & 0x07 );

		$Global_rgb = substr ( $this->BUF [ 0  ], 13,
							3 * ( 2 << ( ord ( $this->BUF [ 0  ] { 10 } ) & 0x07 ) ) );
		$Locals_rgb = substr ( $this->BUF [ $i ], 13,
							3 * ( 2 << ( ord ( $this->BUF [ $i ] { 10 } ) & 0x07 ) ) );

		$Locals_ext = "!\xF9\x04" . chr ( ( $this->DIS << 2 ) + 0 ) .
						chr ( ( $d >> 0 ) & 0xFF ) . chr ( ( $d >> 8 ) & 0xFF ) . "\x0\x0";

		if ( $this->COL > -1 && ord ( $this->BUF [ $i ] { 10 } ) & 0x80 ) {
			for ( $j = 0; $j < ( 2 << ( ord ( $this->BUF [ $i ] { 10 } ) & 0x07 ) ); $j++ ) {
				if	(
						ord ( $Locals_rgb { 3 * $j + 0 } ) == ( ( $this->COL >> 16 ) & 0xFF ) &&
						ord ( $Locals_rgb { 3 * $j + 1 } ) == ( ( $this->COL >>  8 ) & 0xFF ) &&
						ord ( $Locals_rgb { 3 * $j + 2 } ) == ( ( $this->COL >>  0 ) & 0xFF )
					) {
					$Locals_ext = "!\xF9\x04" . chr ( ( $this->DIS << 2 ) + 1 ) .
									chr ( ( $d >> 0 ) & 0xFF ) . chr ( ( $d >> 8 ) & 0xFF ) . chr ( $j ) . "\x0";
					break;
				}
			}
		}
		switch ( $Locals_tmp { 0 } ) {
			case "!":
				$Locals_img = substr ( $Locals_tmp, 8, 10 );
				$Locals_tmp = substr ( $Locals_tmp, 18, strlen ( $Locals_tmp ) - 18 );
				break;
			case ",":
				$Locals_img = substr ( $Locals_tmp, 0, 10 );
				$Locals_tmp = substr ( $Locals_tmp, 10, strlen ( $Locals_tmp ) - 10 );
				break;
		}
		if ( ord ( $this->BUF [ $i ] { 10 } ) & 0x80 && $this->IMG > -1 ) {
			if ( $Global_len == $Locals_len ) {
				if ( GIFEncoder::GIFBlockCompare ( $Global_rgb, $Locals_rgb, $Global_len ) ) {
					$this->GIF .= ( $Locals_ext . $Locals_img . $Locals_tmp );
				}
				else {
					/*
					 *
					 * XY Padding...
					 *
					 */
					if ( $this->SIG == 1 ) {
						$Locals_img { 1 } = chr ( $this->OFS [ $i ] [ 0 ] & 0xFF );
						$Locals_img { 2 } = chr ( ( $$this->OFS [ $i ] [ 0 ] & 0xFF00 ) >> 8 );
						$Locals_img { 3 } = chr ( $this->OFS [ $i ] [ 1 ] & 0xFF );
						$Locals_img { 4 } = chr ( ( $this->OFS [ $i ] [ 1 ] & 0xFF00 ) >> 8 );
					}
					$byte  = ord ( $Locals_img { 9 } );
					$byte |= 0x80;
					$byte &= 0xF8;
					$byte |= ( ord ( $this->BUF [ 0 ] { 10 } ) & 0x07 );
					$Locals_img { 9 } = chr ( $byte );
					$this->GIF .= ( $Locals_ext . $Locals_img . $Locals_rgb . $Locals_tmp );
				}
			}
			else {
				/*
				 *
				 * XY Padding...
				 *
				 */
				if ( $this->SIG == 1 ) {
					$Locals_img { 1 } = chr ( $this->OFS [ $i ] [ 0 ] & 0xFF );
					$Locals_img { 2 } = chr ( ( $$this->OFS [ $i ] [ 0 ] & 0xFF00 ) >> 8 );
					$Locals_img { 3 } = chr ( $this->OFS [ $i ] [ 1 ] & 0xFF );
					$Locals_img { 4 } = chr ( ( $this->OFS [ $i ] [ 1 ] & 0xFF00 ) >> 8 );
				}
				$byte  = ord ( $Locals_img { 9 } );
				$byte |= 0x80;
				$byte &= 0xF8;
				$byte |= ( ord ( $this->BUF [ $i ] { 10 } ) & 0x07 );
				$Locals_img { 9 } = chr ( $byte );
				$this->GIF .= ( $Locals_ext . $Locals_img . $Locals_rgb . $Locals_tmp );
			}
		}
		else {
			$this->GIF .= ( $Locals_ext . $Locals_img . $Locals_tmp );
		}
		$this->IMG  = 1;
	}
Example #2
0
 private function GIFAddFrames($i, $d)
 {
     $Locals_str = 13 + 3 * (2 << (ord($this->BUF[$i][10]) & 0x7));
     $Locals_end = strlen($this->BUF[$i]) - $Locals_str - 1;
     $Locals_tmp = substr($this->BUF[$i], $Locals_str, $Locals_end);
     $Global_len = 2 << (ord($this->BUF[0][10]) & 0x7);
     $Locals_len = 2 << (ord($this->BUF[$i][10]) & 0x7);
     $Global_rgb = substr($this->BUF[0], 13, 3 * (2 << (ord($this->BUF[0][10]) & 0x7)));
     $Locals_rgb = substr($this->BUF[$i], 13, 3 * (2 << (ord($this->BUF[$i][10]) & 0x7)));
     $Locals_ext = "!�" . chr(($this->DIS << 2) + 0) . chr($d >> 0 & 0xff) . chr($d >> 8 & 0xff) . "";
     if ($this->COL > -1 && ord($this->BUF[$i][10]) & 0x80) {
         for ($j = 0; $j < 2 << (ord($this->BUF[$i][10]) & 0x7); $j++) {
             if (ord($Locals_rgb[3 * $j + 0]) == ($this->COL >> 16 & 0xff) && ord($Locals_rgb[3 * $j + 1]) == ($this->COL >> 8 & 0xff) && ord($Locals_rgb[3 * $j + 2]) == ($this->COL >> 0 & 0xff)) {
                 $Locals_ext = "!�" . chr(($this->DIS << 2) + 1) . chr($d >> 0 & 0xff) . chr($d >> 8 & 0xff) . chr($j) . "";
                 break;
             }
         }
     }
     switch ($Locals_tmp[0]) {
         case "!":
             $Locals_img = substr($Locals_tmp, 8, 10);
             $Locals_tmp = substr($Locals_tmp, 18, strlen($Locals_tmp) - 18);
             break;
         case ",":
             $Locals_img = substr($Locals_tmp, 0, 10);
             $Locals_tmp = substr($Locals_tmp, 10, strlen($Locals_tmp) - 10);
             break;
     }
     if (ord($this->BUF[$i][10]) & 0x80 && $this->IMG > -1) {
         if ($Global_len == $Locals_len) {
             if (GIFEncoder::GIFBlockCompare($Global_rgb, $Locals_rgb, $Global_len)) {
                 $this->GIF .= $Locals_ext . $Locals_img . $Locals_tmp;
             } else {
                 $byte = ord($Locals_img[9]);
                 $byte |= 0x80;
                 $byte &= 0xf8;
                 $byte |= ord($this->BUF[0][10]) & 0x7;
                 $Locals_img[9] = chr($byte);
                 $this->GIF .= $Locals_ext . $Locals_img . $Locals_rgb . $Locals_tmp;
             }
         } else {
             $byte = ord($Locals_img[9]);
             $byte |= 0x80;
             $byte &= 0xf8;
             $byte |= ord($this->BUF[$i][10]) & 0x7;
             $Locals_img[9] = chr($byte);
             $this->GIF .= $Locals_ext . $Locals_img . $Locals_rgb . $Locals_tmp;
         }
     } else {
         $this->GIF .= $Locals_ext . $Locals_img . $Locals_tmp;
     }
     $this->IMG = 1;
 }
Example #3
0
 function GIFAddFrames($i, $d, $GIF_dis)
 {
     $this->DIS = $GIF_dis > -1 ? $GIF_dis < 3 ? $GIF_dis : 3 : 2;
     $Locals_str = 13 + 3 * (2 << (ord($this->BUF[$i][10]) & 0x7));
     $Locals_end = strlen($this->BUF[$i]) - $Locals_str - 1;
     $Locals_tmp = substr($this->BUF[$i], $Locals_str, $Locals_end);
     $Global_len = 2 << (ord($this->BUF[0][10]) & 0x7);
     $Locals_len = 2 << (ord($this->BUF[$i][10]) & 0x7);
     $Global_rgb = substr($this->BUF[0], 13, 3 * (2 << (ord($this->BUF[0][10]) & 0x7)));
     $Locals_rgb = substr($this->BUF[$i], 13, 3 * (2 << (ord($this->BUF[$i][10]) & 0x7)));
     $Locals_ext = "!ù" . chr(($this->DIS << 2) + 0) . chr($d >> 0 & 0xff) . chr($d >> 8 & 0xff) . "";
     if ($this->COL > -1 && ord($this->BUF[$i][10]) & 0x80) {
         for ($j = 0; $j < 2 << (ord($this->BUF[$i][10]) & 0x7); $j++) {
             if (ord($Locals_rgb[3 * $j + 0]) == ($this->COL >> 16 & 0xff) && ord($Locals_rgb[3 * $j + 1]) == ($this->COL >> 8 & 0xff) && ord($Locals_rgb[3 * $j + 2]) == ($this->COL >> 0 & 0xff)) {
                 $Locals_ext = "!ù" . chr(($this->DIS << 2) + 1) . chr($d >> 0 & 0xff) . chr($d >> 8 & 0xff) . chr($j) . "";
                 break;
             }
         }
     }
     switch ($Locals_tmp[0]) {
         case "!":
             $Locals_img = substr($Locals_tmp, 8, 10);
             $Locals_tmp = substr($Locals_tmp, 18, strlen($Locals_tmp) - 18);
             break;
         case ",":
             $Locals_img = substr($Locals_tmp, 0, 10);
             $Locals_tmp = substr($Locals_tmp, 10, strlen($Locals_tmp) - 10);
             break;
     }
     if (ord($this->BUF[$i][10]) & 0x80 && $this->IMG > -1) {
         if ($Global_len == $Locals_len) {
             if (GIFEncoder::GIFBlockCompare($Global_rgb, $Locals_rgb, $Global_len)) {
                 $this->GIF .= $Locals_ext . $Locals_img . $Locals_tmp;
             } else {
                 //XY Padding...
                 if ($this->SIG == 1) {
                     $Locals_img[1] = chr($this->OFS[$i]["offset_left"] * $this->wr & 0xff);
                     $Locals_img[2] = chr(($this->OFS[$i]["offset_left"] * $this->wr & 0xff00) >> 8);
                     $Locals_img[3] = chr($this->OFS[$i]["offset_top"] * $this->hr & 0xff);
                     $Locals_img[4] = chr(($this->OFS[$i]["offset_top"] * $this->hr & 0xff00) >> 8);
                 }
                 $byte = ord($Locals_img[9]);
                 $byte |= 0x80;
                 $byte &= 0xf8;
                 $byte |= ord($this->BUF[0][10]) & 0x7;
                 $Locals_img[9] = chr($byte);
                 $this->GIF .= $Locals_ext . $Locals_img . $Locals_rgb . $Locals_tmp;
             }
         } else {
             //XY Padding...
             if ($this->SIG == 1) {
                 $Locals_img[1] = chr($this->OFS[$i]["offset_left"] * $this->wr & 0xff);
                 $Locals_img[2] = chr(($this->OFS[$i]["offset_left"] * $this->wr & 0xff00) >> 8);
                 $Locals_img[3] = chr($this->OFS[$i]["offset_top"] * $this->hr & 0xff);
                 $Locals_img[4] = chr(($this->OFS[$i]["offset_top"] * $this->hr & 0xff00) >> 8);
             }
             $byte = ord($Locals_img[9]);
             $byte |= 0x80;
             $byte &= 0xf8;
             $byte |= ord($this->BUF[$i][10]) & 0x7;
             $Locals_img[9] = chr($byte);
             $this->GIF .= $Locals_ext . $Locals_img . $Locals_rgb . $Locals_tmp;
         }
     } else {
         $this->GIF .= $Locals_ext . $Locals_img . $Locals_tmp;
     }
     $this->IMG = 1;
 }