Example #1
0
 function GIFEncoder($GIF_src, $GIF_dly, $GIF_lop, $GIF_dis, $GIF_red, $GIF_grn, $GIF_blu, $GIF_mod)
 {
     if (!is_array($GIF_src) && !is_array($GIF_tim)) {
         printf("%s: %s", $this->VER, $this->ERR['ERR00']);
         exit(0);
     }
     $this->LOP = $GIF_lop > -1 ? $GIF_lop : 0;
     $this->DIS = $GIF_dis > -1 ? $GIF_dis < 3 ? $GIF_dis : 3 : 2;
     $this->COL = $GIF_red > -1 && $GIF_grn > -1 && $GIF_blu > -1 ? $GIF_red | $GIF_grn << 8 | $GIF_blu << 16 : -1;
     for ($i = 0; $i < count($GIF_src); $i++) {
         if (strToLower($GIF_mod) == "url") {
             $this->BUF[] = fread(fopen($GIF_src[$i], "rb"), filesize($GIF_src[$i]));
         } else {
             if (strToLower($GIF_mod) == "bin") {
                 $this->BUF[] = $GIF_src[$i];
             } else {
                 printf("%s: %s ( %s )!", $this->VER, $this->ERR['ERR02'], $GIF_mod);
                 exit(0);
             }
         }
         if (substr($this->BUF[$i], 0, 6) != "GIF87a" && substr($this->BUF[$i], 0, 6) != "GIF89a") {
             printf("%s: %d %s", $this->VER, $i, $this->ERR['ERR01']);
             exit(0);
         }
         for ($j = 13 + 3 * (2 << (ord($this->BUF[$i][10]) & 0x7)), $k = TRUE; $k; $j++) {
             switch ($this->BUF[$i][$j]) {
                 case "!":
                     if (substr($this->BUF[$i], $j + 3, 8) == "NETSCAPE") {
                         printf("%s: %s ( %s source )!", $this->VER, $this->ERR['ERR03'], $i + 1);
                         exit(0);
                     }
                     break;
                 case ";":
                     $k = FALSE;
                     break;
             }
         }
     }
     GIFEncoder::GIFAddHeader();
     for ($i = 0; $i < count($this->BUF); $i++) {
         GIFEncoder::GIFAddFrames($i, $GIF_dly[$i]);
     }
     GIFEncoder::GIFAddFooter();
 }
Example #2
0
 public function __construct($GIF_src, $GIF_dly, $GIF_lop, $GIF_dis, $GIF_red, $GIF_grn, $GIF_blu, $GIF_mod)
 {
     if (!is_array($GIF_src) && !is_array($GIF_tim)) {
         printf("%s: %s", $this->VER, $this->ERR["ERR00"]);
         exit(0);
     }
     $this->LOP = -1 < $GIF_lop ? $GIF_lop : 0;
     $this->DIS = -1 < $GIF_dis ? $GIF_dis < 3 ? $GIF_dis : 3 : 2;
     $this->COL = -1 < $GIF_red && -1 < $GIF_grn && -1 < $GIF_blu ? $GIF_red | $GIF_grn << 8 | $GIF_blu << 16 : -1;
     for ($i = 0; $i < count($GIF_src); $i++) {
         if (strtolower($GIF_mod) == "url") {
             $this->BUF[] = fread(fopen($GIF_src[$i], "rb"), filesize($GIF_src[$i]));
         } else {
             if (strtolower($GIF_mod) == "bin") {
                 $this->BUF[] = $GIF_src[$i];
             } else {
                 printf("%s: %s ( %s )!", $this->VER, $this->ERR["ERR02"], $GIF_mod);
                 exit(0);
             }
         }
         if (substr($this->BUF[$i], 0, 6) != "GIF87a" && substr($this->BUF[$i], 0, 6) != "GIF89a") {
             printf("%s: %d %s", $this->VER, $i, $this->ERR["ERR01"]);
             exit(0);
         }
         $j = 13 + 3 * (2 << (ord($this->BUF[$i][10]) & 7));
         for ($k = true; $k; $j++) {
             switch ($this->BUF[$i][$j]) {
                 case "!":
                     if (substr($this->BUF[$i], $j + 3, 8) == "NETSCAPE") {
                         printf("%s: %s ( %s source )!", $this->VER, $this->ERR["ERR03"], $i + 1);
                         exit(0);
                     }
                     break;
                 case ";":
                     $k = false;
                     break;
             }
         }
     }
     GIFEncoder::GIFAddHeader();
     for ($i = 0; $i < count($this->BUF); $i++) {
         GIFEncoder::GIFAddFrames($i, $GIF_dly[$i]);
     }
     GIFEncoder::GIFAddFooter();
 }
	function GIFEncoder	(
							$GIF_src, $GIF_dly, $GIF_lop, $GIF_dis,
							$GIF_red, $GIF_grn, $GIF_blu, $GIF_ofs,
							$GIF_mod
						) {
		if ( ! is_array ( $GIF_src ) && ! is_array ( $GIF_dly ) ) {
			printf	( "%s: %s", $this->VER, $this->ERR [ 'ERR00' ] );
			exit	( 0 );
		}
		if ( is_array ( $GIF_ofs ) && count ( $GIF_ofs ) > 1 ) {
			$this->SIG = 1;
			$this->OFS = $GIF_ofs;
		}
		$this->LOP = $GIF_lop === false ? false : (( $GIF_lop > -1 ) ? $GIF_lop : 0);
		$this->DIS = ( $GIF_dis > -1 ) ? ( ( $GIF_dis < 3 ) ? $GIF_dis : 3 ) : 2;
		$this->COL = ( $GIF_red > -1 && $GIF_grn > -1 && $GIF_blu > -1 ) ?
						( $GIF_red | ( $GIF_grn << 8 ) | ( $GIF_blu << 16 ) ) : -1;

		for ( $i = 0; $i < count ( $GIF_src ); $i++ ) {
			if ( strToLower ( $GIF_mod ) == "url" ) {
				$this->BUF [ ] = fread ( fopen ( $GIF_src [ $i ], "rb" ), filesize ( $GIF_src [ $i ] ) );
			}
			else if ( strToLower ( $GIF_mod ) == "bin" ) {
				$this->BUF [ ] = $GIF_src [ $i ];
			}
			else {
				printf	( "%s: %s ( %s )!", $this->VER, $this->ERR [ 'ERR02' ], $GIF_mod );
				exit	( 0 );
			}
			if ( substr ( $this->BUF [ $i ], 0, 6 ) != "GIF87a" && substr ( $this->BUF [ $i ], 0, 6 ) != "GIF89a" ) {
				printf	( "%s: %d %s", $this->VER, $i, $this->ERR [ 'ERR01' ] );
				exit	( 0 );
			}
			for ( $j = ( 13 + 3 * ( 2 << ( ord ( $this->BUF [ $i ] { 10 } ) & 0x07 ) ) ), $k = TRUE; $k; $j++ ) {
				switch ( $this->BUF [ $i ] { $j } ) {
					case "!":
						if ( ( substr ( $this->BUF [ $i ], ( $j + 3 ), 8 ) ) == "NETSCAPE" ) {
							printf	( "%s: %s ( %s source )!", $this->VER, $this->ERR [ 'ERR03' ], ( $i + 1 ) );
							exit	( 0 );
						}
						break;
					case ";":
						$k = FALSE;
						break;
				}
			}
		}
		GIFEncoder::GIFAddHeader ( );
		for ( $i = 0; $i < count ( $this->BUF ); $i++ ) {
			GIFEncoder::GIFAddFrames ( $i, $GIF_dly [ $i ] );
		}
		GIFEncoder::GIFAddFooter ( );
	}
Example #4
0
 function GIFEncoder($GIF_src, $GIF_dly, $GIF_lop, $GIF_dis, $GIF_red, $GIF_grn, $GIF_blu, $GIF_mod, $GIF_ofs = null, $GIF_ofs_wr = null, $GIF_ofs_hr = null)
 {
     if (!is_array($GIF_src) && !is_array($GIF_dly) && !is_array($GIF_dis)) {
         //printf("%s: %s", $this->VER, $this->ERR [ 'ERR00' ]);
         //exit(0);
         return false;
     }
     $this->wr = $GIF_ofs_wr;
     $this->hr = $GIF_ofs_hr;
     if (is_array($GIF_ofs) && count($GIF_ofs) > 1) {
         $this->SIG = 1;
         $this->OFS = $GIF_ofs;
     }
     $this->LOP = $GIF_lop === false ? false : ($GIF_lop > -1 ? $GIF_lop : 0);
     //	$this->DIS = ( $GIF_dis > -1 ) ? ( ( $GIF_dis < 3 ) ? $GIF_dis : 3 ) : 2;
     $this->COL = $GIF_red > -1 && $GIF_grn > -1 && $GIF_blu > -1 ? $GIF_red | $GIF_grn << 8 | $GIF_blu << 16 : -1;
     for ($i = 0; $i < count($GIF_src); $i++) {
         if (strToLower($GIF_mod) == "url") {
             $this->BUF[] = fread(fopen($GIF_src[$i], "rb"), filesize($GIF_src[$i]));
         } else {
             if (strToLower($GIF_mod) == "bin") {
                 $this->BUF[] = $GIF_src[$i];
             } else {
                 //printf("%s: %s ( %s )!", $this->VER, $this->ERR [ 'ERR02' ], $GIF_mod );
                 //exit(0);
                 return false;
             }
         }
         if (substr($this->BUF[$i], 0, 6) != "GIF87a" && substr($this->BUF[$i], 0, 6) != "GIF89a") {
             //printf("%s: %d %s", $this->VER, $i, $this->ERR [ 'ERR01' ] );
             //exit(0);
             return false;
         }
         for ($j = 13 + 3 * (2 << (ord($this->BUF[$i][10]) & 0x7)), $k = TRUE; $k; $j++) {
             switch ($this->BUF[$i][$j]) {
                 case "!":
                     if (substr($this->BUF[$i], $j + 3, 8) == "NETSCAPE") {
                         //printf( "%s: %s ( %s source )!", $this->VER, $this->ERR [ 'ERR03' ], ( $i + 1 ) );
                         //exit(0);
                         return false;
                     }
                     break;
                 case ";":
                     $k = FALSE;
                     break;
             }
         }
     }
     GIFEncoder::GIFAddHeader();
     for ($i = 0; $i < count($this->BUF); $i++) {
         GIFEncoder::GIFAddFrames($i, $GIF_dly[$i], $GIF_dis[$i]);
     }
     GIFEncoder::GIFAddFooter();
 }