1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-10 16:54:44 +02:00
This commit is contained in:
Ryan Cramer
2020-05-14 15:27:40 -04:00
parent ebe352d5cc
commit 4620c2ebff
2 changed files with 27 additions and 26 deletions

View File

@@ -245,7 +245,7 @@ class ISEAG_GIFDecoder {
$this->GIF_buffer->setSize($i);
return 0;
}
$this->GIF_buffer [$i] = ord ( $this->GIF_stream { $this->GIF_bfseek++ } );
$this->GIF_buffer [$i] = ord ( $this->GIF_stream [ $this->GIF_bfseek++ ] );
}
return 1;
}

View File

@@ -101,8 +101,8 @@ class ISEAG_GIFEncoder {
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 } ) {
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 ) );
@@ -130,8 +130,8 @@ class ISEAG_GIFEncoder {
function GIFAddHeader ( ) {
$cmap = 0;
if ( ord ( $this->BUF [ 0 ] { 10 } ) & 0x80 ) {
$cmap = 3 * ( 2 << ( ord ( $this->BUF [ 0 ] { 10 } ) & 0x07 ) );
if ( ord ( $this->BUF [ 0 ] [ 10 ] ) & 0x80 ) {
$cmap = 3 * ( 2 << ( ord ( $this->BUF [ 0 ] [ 10 ] ) & 0x07 ) );
$this->GIF .= substr ( $this->BUF [ 0 ], 6, 7 );
$this->GIF .= substr ( $this->BUF [ 0 ], 13, $cmap );
@@ -146,28 +146,29 @@ class ISEAG_GIFEncoder {
*/
function GIFAddFrames ( $i, $d ) {
$Locals_str = 13 + 3 * ( 2 << ( ord ( $this->BUF [ $i ] { 10 } ) & 0x07 ) );
$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_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 ) ) );
3 * ( 2 << ( ord ( $this->BUF [ 0 ] [ 10 ] ) & 0x07 ) ) );
$Locals_rgb = substr ( $this->BUF [ $i ], 13,
3 * ( 2 << ( ord ( $this->BUF [ $i ] { 10 } ) & 0x07 ) ) );
3 * ( 2 << ( ord ( $this->BUF [ $i ] [ 10 ] ) & 0x07 ) ) );
$Locals_ext = "!\xF9\x04" . chr ( ( $this->DIS[$i] << 2 ) + 0 ) .
chr ( ( $d >> 0 ) & 0xFF ) . chr ( ( $d >> 8 ) & 0xFF ) . "\x0\x0";
$Locals_img = '';
if ( $this->TRANSPARENT_R > -1 && ord ( $this->BUF [ $i ] { 10 } ) & 0x80 ) {
for ( $j = 0; $j < ( 2 << ( ord ( $this->BUF [ $i ] { 10 } ) & 0x07 ) ); $j++ ) {
if ( $this->TRANSPARENT_R > -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->TRANSPARENT_R &&
ord ( $Locals_rgb { 3 * $j + 1 } ) == $this->TRANSPARENT_G &&
ord ( $Locals_rgb { 3 * $j + 2 } ) == $this->TRANSPARENT_B )
ord ( $Locals_rgb [ 3 * $j + 0 ] ) == $this->TRANSPARENT_R &&
ord ( $Locals_rgb [ 3 * $j + 1 ] ) == $this->TRANSPARENT_G &&
ord ( $Locals_rgb [ 3 * $j + 2 ] ) == $this->TRANSPARENT_B )
{
$Locals_ext = "!\xF9\x04" . chr ( ( $this->DIS[$i] << 2 ) ) .
chr ( ( $d >> 0 ) & 0xFF ) . chr ( ( $d >> 8 ) & 0xFF ) . chr ( $j ) . "\x0";
@@ -175,7 +176,7 @@ class ISEAG_GIFEncoder {
}
}
}
switch ( $Locals_tmp { 0 } ) {
switch ( $Locals_tmp [ 0 ] ) {
case "!":
$Locals_img = substr ( $Locals_tmp, 8, 10 );
$Locals_ext[3] = chr((ord($Locals_ext[3]) & 0xFE) | (ord($Locals_tmp[3]) & 0x01));
@@ -186,26 +187,26 @@ class ISEAG_GIFEncoder {
$Locals_tmp = substr ( $Locals_tmp, 10, strlen ( $Locals_tmp ) - 10 );
break;
}
if ( ord ( $this->BUF [ $i ] { 10 } ) & 0x80 && $this->IMG > -1 ) {
if ( ord ( $this->BUF [ $i ] [ 10 ] ) & 0x80 && $this->IMG > -1 ) {
if ( $Global_len == $Locals_len ) {
if ( ISEAG_GIFEncoder::GIFBlockCompare ( $Global_rgb, $Locals_rgb, $Global_len ) ) {
$this->GIF .= ( $Locals_ext . $Locals_img . $Locals_tmp );
}
else {
$byte = ord ( $Locals_img { 9 } );
$byte = ord ( $Locals_img [ 9 ] );
$byte |= 0x80;
$byte &= 0xF8;
$byte |= ( ord ( $this->BUF [ 0 ] { 10 } ) & 0x07 );
$Locals_img { 9 } = chr ( $byte );
$byte |= ( ord ( $this->BUF [ 0 ] [ 10 ] ) & 0x07 );
$Locals_img [ 9 ] = chr ( $byte );
$this->GIF .= ( $Locals_ext . $Locals_img . $Locals_rgb . $Locals_tmp );
}
}
else {
$byte = ord ( $Locals_img { 9 } );
$byte = ord ( $Locals_img [ 9 ] );
$byte |= 0x80;
$byte &= 0xF8;
$byte |= ( ord ( $this->BUF [ $i ] { 10 } ) & 0x07 );
$Locals_img { 9 } = chr ( $byte );
$byte |= ( ord ( $this->BUF [ $i ] [ 10 ] ) & 0x07 );
$Locals_img [ 9 ] = chr ( $byte );
$this->GIF .= ( $Locals_ext . $Locals_img . $Locals_rgb . $Locals_tmp );
}
}
@@ -233,9 +234,9 @@ class ISEAG_GIFEncoder {
for ( $i = 0; $i < $Len; $i++ ) {
if (
$GlobalBlock { 3 * $i + 0 } != $LocalBlock { 3 * $i + 0 } ||
$GlobalBlock { 3 * $i + 1 } != $LocalBlock { 3 * $i + 1 } ||
$GlobalBlock { 3 * $i + 2 } != $LocalBlock { 3 * $i + 2 }
$GlobalBlock [ 3 * $i + 0 ] != $LocalBlock [ 3 * $i + 0 ] ||
$GlobalBlock [ 3 * $i + 1 ] != $LocalBlock [ 3 * $i + 1 ] ||
$GlobalBlock [ 3 * $i + 2 ] != $LocalBlock [ 3 * $i + 2 ]
) {
return ( 0 );
}