mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-05 14:52:47 +08:00
更正Org命名空间
This commit is contained in:
@@ -9,23 +9,27 @@
|
||||
// | Author: 麦当苗儿 <zuojiazi.cn@gmail.com> <http://www.zjzit.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace think\image\driver;
|
||||
namespace org\image\driver;
|
||||
|
||||
class Gif
|
||||
{
|
||||
/**
|
||||
* GIF帧列表
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $frames = [];
|
||||
|
||||
/**
|
||||
* 每帧等待时间列表
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $delays = [];
|
||||
|
||||
/**
|
||||
* 构造方法,用于解码GIF图片
|
||||
*
|
||||
* @param string $src GIF图片数据
|
||||
* @param string $mod 图片数据类型
|
||||
*/
|
||||
@@ -49,6 +53,7 @@ class Gif
|
||||
|
||||
/**
|
||||
* 设置或获取当前帧的数据
|
||||
*
|
||||
* @param string $stream 二进制数据流
|
||||
* @return mixed 获取到的数据
|
||||
*/
|
||||
@@ -57,13 +62,13 @@ class Gif
|
||||
if (is_null($stream)) {
|
||||
$current = current($this->frames);
|
||||
return false === $current ? reset($this->frames) : $current;
|
||||
} else {
|
||||
$this->frames[key($this->frames)] = $stream;
|
||||
}
|
||||
$this->frames[key($this->frames)] = $stream;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将当前帧移动到下一帧
|
||||
*
|
||||
* @return string 当前帧数据
|
||||
*/
|
||||
public function nextImage()
|
||||
@@ -73,6 +78,7 @@ class Gif
|
||||
|
||||
/**
|
||||
* 编码并保存当前GIF图片
|
||||
*
|
||||
* @param string $gifname 图片名称
|
||||
*/
|
||||
public function save($gifname)
|
||||
@@ -141,7 +147,7 @@ class GIFEncode
|
||||
$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;
|
||||
($GIF_red | ($GIF_grn << 8) | ($GIF_blu << 16)) : -1;
|
||||
|
||||
for ($i = 0; $i < count($GIF_src); $i++) {
|
||||
if (strToLower($GIF_mod) == "url") {
|
||||
@@ -158,15 +164,15 @@ class GIFEncode
|
||||
}
|
||||
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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -201,7 +207,7 @@ class GIFEncode
|
||||
*/
|
||||
public function GIFAddFrames($i, $d)
|
||||
{
|
||||
$Locals_img='';
|
||||
$Locals_img = '';
|
||||
$Locals_str = 13 + 3 * (2 << (ord($this->BUF[$i]{10}) & 0x07));
|
||||
|
||||
$Locals_end = strlen($this->BUF[$i]) - $Locals_str - 1;
|
||||
@@ -211,12 +217,12 @@ class GIFEncode
|
||||
$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 << 2) + 0) .
|
||||
chr(($d >> 0) & 0xFF) . chr(($d >> 8) & 0xFF) . "\x0\x0";
|
||||
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++) {
|
||||
@@ -226,23 +232,23 @@ class GIFEncode
|
||||
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";
|
||||
chr(($d >> 0) & 0xFF) . chr(($d >> 8) & 0xFF) . chr($j) . "\x0";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
switch ($Locals_tmp{0}) {
|
||||
case "!":
|
||||
/**
|
||||
* @var string $Locals_img;
|
||||
*/
|
||||
$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;
|
||||
case "!":
|
||||
/**
|
||||
* @var string $Locals_img;
|
||||
*/
|
||||
$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) {
|
||||
|
||||
Reference in New Issue
Block a user