diff --git a/niucloud/vendor/composer/InstalledVersions.php b/niucloud/vendor/composer/InstalledVersions.php
index c6b54af7b..51e734a77 100644
--- a/niucloud/vendor/composer/InstalledVersions.php
+++ b/niucloud/vendor/composer/InstalledVersions.php
@@ -98,7 +98,7 @@ class InstalledVersions
{
foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) {
- return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
+ return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
}
}
@@ -119,7 +119,7 @@ class InstalledVersions
*/
public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
- $constraint = $parser->parseConstraints($constraint);
+ $constraint = $parser->parseConstraints((string) $constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint);
@@ -328,7 +328,9 @@ class InstalledVersions
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
- $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
+ /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */
+ $required = require $vendorDir.'/composer/installed.php';
+ $installed[] = self::$installedByVendor[$vendorDir] = $required;
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $installed[count($installed) - 1];
}
@@ -340,12 +342,17 @@ class InstalledVersions
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
- self::$installed = require __DIR__ . '/installed.php';
+ /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */
+ $required = require __DIR__ . '/installed.php';
+ self::$installed = $required;
} else {
self::$installed = array();
}
}
- $installed[] = self::$installed;
+
+ if (self::$installed !== array()) {
+ $installed[] = self::$installed;
+ }
return $installed;
}
diff --git a/niucloud/vendor/composer/autoload_psr4.php b/niucloud/vendor/composer/autoload_psr4.php
index 5ac1441af..a234978f9 100644
--- a/niucloud/vendor/composer/autoload_psr4.php
+++ b/niucloud/vendor/composer/autoload_psr4.php
@@ -68,6 +68,7 @@ return array(
'League\\MimeTypeDetection\\' => array($vendorDir . '/league/mime-type-detection/src'),
'League\\Flysystem\\' => array($vendorDir . '/league/flysystem/src'),
'Laravel\\SerializableClosure\\' => array($vendorDir . '/laravel/serializable-closure/src'),
+ 'Kkokk\\Poster\\' => array($vendorDir . '/kkokk/poster/src'),
'JmesPath\\' => array($vendorDir . '/mtdowling/jmespath.php/src'),
'Invoker\\' => array($vendorDir . '/php-di/invoker/src'),
'Intervention\\Image\\' => array($vendorDir . '/intervention/image/src/Intervention/Image'),
diff --git a/niucloud/vendor/composer/autoload_static.php b/niucloud/vendor/composer/autoload_static.php
index 9808f331e..fe89f840e 100644
--- a/niucloud/vendor/composer/autoload_static.php
+++ b/niucloud/vendor/composer/autoload_static.php
@@ -147,6 +147,10 @@ class ComposerStaticInitf082efa3600aae2b847c3e8b4e641a4e
'League\\Flysystem\\' => 17,
'Laravel\\SerializableClosure\\' => 28,
),
+ 'K' =>
+ array (
+ 'Kkokk\\Poster\\' => 13,
+ ),
'J' =>
array (
'JmesPath\\' => 9,
@@ -456,6 +460,10 @@ class ComposerStaticInitf082efa3600aae2b847c3e8b4e641a4e
array (
0 => __DIR__ . '/..' . '/laravel/serializable-closure/src',
),
+ 'Kkokk\\Poster\\' =>
+ array (
+ 0 => __DIR__ . '/..' . '/kkokk/poster/src',
+ ),
'JmesPath\\' =>
array (
0 => __DIR__ . '/..' . '/mtdowling/jmespath.php/src',
diff --git a/niucloud/vendor/composer/installed.json b/niucloud/vendor/composer/installed.json
index 19e1cb4cc..b4af6ae1d 100644
--- a/niucloud/vendor/composer/installed.json
+++ b/niucloud/vendor/composer/installed.json
@@ -1677,6 +1677,59 @@
],
"install-path": "../intervention/image"
},
+ {
+ "name": "kkokk/poster",
+ "version": "v2.3.2",
+ "version_normalized": "2.3.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/kkokk/poster.git",
+ "reference": "6fa26bb225d0d7bcd654c93d342abf5284803203"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/kkokk/poster/zipball/6fa26bb225d0d7bcd654c93d342abf5284803203",
+ "reference": "6fa26bb225d0d7bcd654c93d342abf5284803203",
+ "shasum": "",
+ "mirrors": [
+ {
+ "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+ "preferred": true
+ }
+ ]
+ },
+ "require": {
+ "ext-gd": "*",
+ "ext-iconv": "*",
+ "ext-json": "*",
+ "ext-mbstring": "*",
+ "php": ">=5.6.0"
+ },
+ "time": "2024-04-02T09:33:45+00:00",
+ "type": "project",
+ "installation-source": "dist",
+ "autoload": {
+ "psr-4": {
+ "Kkokk\\Poster\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "lang",
+ "email": "732853989@qq.com"
+ }
+ ],
+ "description": "PHP生成海报",
+ "support": {
+ "issues": "https://github.com/kkokk/poster/issues",
+ "source": "https://github.com/kkokk/poster/tree/v2.3.2"
+ },
+ "install-path": "../kkokk/poster"
+ },
{
"name": "kosinix/grafika",
"version": "dev-master",
diff --git a/niucloud/vendor/composer/installed.php b/niucloud/vendor/composer/installed.php
index 95e0a186c..04dceec4d 100644
--- a/niucloud/vendor/composer/installed.php
+++ b/niucloud/vendor/composer/installed.php
@@ -3,7 +3,7 @@
'name' => 'topthink/think',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
- 'reference' => '783127440ec6e7540af2a2126eefb22fad7895ff',
+ 'reference' => 'ce5a9834a9b2c9f70dbc00270fad24bd80a0c025',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -208,6 +208,15 @@
'aliases' => array(),
'dev_requirement' => false,
),
+ 'kkokk/poster' => array(
+ 'pretty_version' => 'v2.3.2',
+ 'version' => '2.3.2.0',
+ 'reference' => '6fa26bb225d0d7bcd654c93d342abf5284803203',
+ 'type' => 'project',
+ 'install_path' => __DIR__ . '/../kkokk/poster',
+ 'aliases' => array(),
+ 'dev_requirement' => false,
+ ),
'kosinix/grafika' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
@@ -783,7 +792,7 @@
'topthink/think' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
- 'reference' => '783127440ec6e7540af2a2126eefb22fad7895ff',
+ 'reference' => 'ce5a9834a9b2c9f70dbc00270fad24bd80a0c025',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
diff --git a/niucloud/vendor/kkokk/poster/.gitignore b/niucloud/vendor/kkokk/poster/.gitignore
new file mode 100644
index 000000000..382f7d1fc
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/.gitignore
@@ -0,0 +1,6 @@
+tests/crop/
+tests/poster/
+tests/server/static/
+vendor/
+composer.lock
+.idea
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/LICENSE b/niucloud/vendor/kkokk/poster/LICENSE
new file mode 100644
index 000000000..261eeb9e9
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/niucloud/vendor/kkokk/poster/README.md b/niucloud/vendor/kkokk/poster/README.md
new file mode 100644
index 000000000..a60c2aaaf
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/README.md
@@ -0,0 +1,1015 @@
+### **poster**
+
+#### 介绍
+
+**得益于 gd、imagick、phpqrcode、wkhtmltopdf**
+
+**主要为了封装一个生成图片便捷的插件,非常感谢使用到的所有工具背后开发者的贡献**
+
+PHP海报生成插件,极速生成方便快捷。
+
+快速生成海报、生成签到日、生成二维码、合成二维码、图片添加水印
+
+滑块验证图片生成、旋转验证图片生成、点击验证图片生成、输入验证图片生成
+
+**小提示:**
+
+**如果无法更新版本,composer 切换回原镜像**
+
+全局设置
+
+composer config -g repo.packagist composer https://repo.packagist.org
+
+#### authors
+lang
+732853989@qq.com
+
+群号 590660254 [点击链接加入群聊【海报图片验证交流群】](https://jq.qq.com/?_wv=1027&k=k374FhrR)
+
+#### 使用文档
+
+> 文档地址:http://langlanglang.gitee.io/poster-doc/
+
+#### 安装或更新
+
+1. composer require kkokk/poster
+2. composer update kkokk/poster
+
+#### 演示效果
+
+##### **输入验证码验证**
+
+数字、算术、中文、字母加数字
+
+##### **点击图片验证**
+
+
+
+##### 旋转图片验证
+
+
+
+##### 滑块验证图片
+
+
+
+##### 海报生成图片示例
+
+
+
+
+
+
+
+演示地址:暂无
+
+ 生成签到日历海报、邀请海报
+
+#### **生成海报**
+
+注意:没有特别说明,统一都是px。
+
+##### 通过 PosterManager 调用
+
+```php
+use Kkokk\Poster\PosterManager; // 使用 PosterManager 调用
+$poster = PosterManager::Poster();
+```
+
+##### 通过 Facades 调用
+
+```php
+use Kkokk\Poster\Facades\Poster; // 使用 Facades\Poster 调用
+
+$result = Poster::config($params)
+ ->buildIm($w,$h,$rgba,$alpha) # 创建画布
+ ->buildImage($src,$dst_x,$dst_y,$src_x,$src_y,$src_w,$src_h,$alpha,$type) # 合成图片
+ ->getPoster(); # 获取合成后图片文件地址
+```
+
+> 技巧:也可以分开使用
+
+```php
+$Poster = Poster::config($params);
+$Poster->buildIm($w,$h,$rgba,$alpha); # 创建画布
+$Poster->buildImage($src,$dst_x,$dst_y,$src_x,$src_y,$src_w,$src_h,$alpha,$type); # 合成图片
+$result = $Poster->getPoster(); # 获取合成后图片文件地址
+```
+
+##### 使用 Gd 拓展
+
+```php
+$poster = PosterManager::Poster(); // 使用 PosterManager 调用
+$Poster = Poster::config($params); // 使用 Facades\Poster 调用
+```
+
+##### 使用 Imagick 拓展
+
+```php
+$poster = PosterManager::Poster()->extension('imagick'); // 使用 PosterManager 调用
+$Poster = Poster::extension('imagick')->config($params); // 使用 Facades\Poster 调用
+```
+
+##### 基础配置
+
+```php
+$params = [
+ 'path' => $path, // 设置路径
+ 'dpi' => $dpi, // int[]|int 设置 dpi 只针对 Imagick 有效
+ 'font_size' => $fontSize, // 统一设置文字大小
+ 'font_rgba' => $rgba, // 统一设置文字颜色
+ 'font_space' => $angle, // 统一设置文字间距
+ 'font_weight' => $angle, // 统一设置文字粗细
+ 'font_family' => $fontFamily, // 统一设置文字字体,字体绝对路径
+ 'font_angle' => $angle, // 统一设置文字旋转角度
+ 'font_max_w' => $maxW, // 统一设置文字最大换行宽度
+];
+$poster->config($params);
+```
+
+##### 设置路径
+
+```php
+$poster->path($path); # 设置路径
+```
+
+参数说明
+
+| 变量 | 类型 | 必填 | 注释 |
+| ---- | ------------- | ---- | ------------------------------ |
+| path | string\|array | 是 | 地址,例如:poster/poster_user |
+
+##### **创建画布**
+
+```php
+$poster->buildIm($w,$h,$rgba,$alpha); # 创建画布
+```
+
+参数说明
+
+| 变量 | 类型 | 必填 | 注释 |
+| ----- | ------- | ---- | ------------------------ |
+| w | number | 是 | 画布宽 |
+| h | number | 是 | 画布高 |
+| rgba | array | 否 | 颜色rbga,[255,255,255,1] |
+| alpha | boolean | 否 | 是否透明,是:true |
+
+##### **创建指定图片为画布**
+
+```php
+$poster->buildImDst($src,$w,$h,$rgba,$alpha); # 创建指定图片为画布
+```
+
+参数说明
+
+| 变量 | 类型 | 必填 | 注释 |
+| ----- | ------- | ---- | ------------------------- |
+| src | source | 是 | 图像资源 |
+| w | number | 否 | 画布宽,默认原图宽 |
+| h | number | 否 | 画布高,默认原图高 |
+| rgba | array | 否 | 颜色rbga,[255,255,255,1] |
+| alpha | boolean | 否 | 是否透明,默认false |
+
+##### **创建背景、遮罩**
+
+> 注意:Imagick 方式,背景目前支持做圆角,渐变色可以支持多种,方向只支持上下
+
+```php
+// 背景 rgba 参数解释
+// color 颜色数组取值范围 0-255
+// alpha 透明度范围 1-127
+// to 颜色渐变方向取值范围 bottom、 top、 left、 right、 left top、 right top、 left bottom、 right bottom 默认 bottom
+// 单色:['color'=>[[0-255,0-255,0-255]],'alpha'=>1-127]
+// 多色渐变:['color'=>[[0-255,0-255,0-255], [0-255,0-255,0-255]],'alpha'=>1-127, 'to'=>'left']
+// radius string|array|integer 圆角 默认0 ( '10 20', [10, 20, 30], 10)
+// [20] 四个角
+// [20,30] 第一个值 左上 右下 第二个值 右上 左下
+// [20,30,20] 第一个值 左上 第二个值 右上 左下 第三个值 右下
+// [20,30,20,10] 左上 右上 右下 左下
+$poster->buildBg(400,526,[
+ 'color'=>[
+ [0,0,162],
+ [0,255,162],
+ [255,255,162],
+ [255, 0, 0],
+ [0, 255, 0]
+ ],
+ 'alpha'=>50,
+ 'to'=>'bottom',
+ 'radius'=>'10'
+], true, ['center', -10], ['center', 10], 0, 0 , function($im){
+ $im->buildText('明月几时有,把酒问青天。不知天上宫阙,今夕是何年。','center',100,20,[255, 255, 255, 50]);
+}); # 创建画布
+```
+
+参数说明
+
+| 变量 | 类型 | 必填 | 注释 |
+| ----- | ------- | ---- | ------------------------ |
+| w | number | 是 | 画布宽 |
+| h | number | 是 | 画布高 |
+| rgba | array | 否 | 详见上方注释 |
+| alpha | boolean | 否 | 是否透明,是:true |
+| dst_x | number\|string\|array | 否 | 画布位置x 特殊值 center 居中,居中并向左偏移 ['center',-5], 居中并向右偏移 ['center',5]; 支持百分比20% 支持自定义 支持正负 |
+| dst_y | number\|string\|array | 否 | 画布位置y 特殊值 center 居中,居中并向上偏移 ['center',-5], 居中并向下偏移 ['center',5]; 支持百分比20% 支持自定义 支持正负 |
+| src_x | number | 否 | 图片x轴,默认0 |
+| src_y | number | 否 | 图片y轴,默认0 |
+| func | closure | 否 | 匿名函数(闭包),可以已当前背景为基础合成相应的内容 |
+
+##### **合成图片**
+
+```php
+/**
+ * 合成图片
+ * @param string|array $src 图片地址,旋转角度
+ */
+$poster->buildImage($src,$dst_x,$dst_y,$src_x,$src_y,$src_w,$src_h,$alpha,$type); # 合成图片
+```
+
+> 注意:旋转角度是顺时针
+
+参数说明
+
+| 变量 | 类型 | 必填 | 注释 |
+| ----- |----------------|----|------------------------------------------------------------------------------------------|
+| src | string\|array | 是 | ['src'=> $src, 'angle'=> $angle]
$src: 路径,支持网络图片(带http或https)
$angle: 旋转角度,顺时针旋转 |
+| dst_x | number\|string | 否 | 画布位置x 特殊值 center 居中,居中并向左偏移 ['center',-5], 居中并向右偏移 ['center',5]; 支持百分比20% 支持自定义 支持正负 |
+| dst_y | number\|string | 否 | 画布位置y 特殊值 center 居中,居中并向上偏移 ['center',-5], 居中并向下偏移 ['center',5]; 支持百分比20% 支持自定义 支持正负 |
+| src_x | number | 否 | 图片x轴,默认0 |
+| src_y | number | 否 | 图片y轴,默认0 |
+| src_w | number | 否 | 图片自定义宽,默认原宽 |
+| src_h | number | 否 | 图片自定义高,默认原高 |
+| alpha | boolean | 否 | 是否透明,true:是 |
+| type | string | 否 | 图片变形类型,正常形状:'normal',圆形:'circle' ,默认normal |
+
+##### **批量合成图片**
+
+```php
+$images = [
+ [
+ 'src' => $src,
+ 'dst_x' => $dst_x,
+ 'dst_y' => $dst_y,
+ 'src_x' => $src_x,
+ 'src_y' => $src_y,
+ 'src_w' => $src_w,
+ 'src_h' => $src_h,
+ 'alpha' => $alpha,
+ 'type' => $type
+ ]
+];
+$poster->buildImageMany($images); # 批量合成图片
+```
+
+参数说明:与**合成图片**参数一致。
+
+##### **合成二维码**
+
+```php
+$poster->buildQr($text,$dst_x,$dst_y,$src_x,$src_y,$src_w,$src_h,$size,$margin); # 合成二维码
+```
+
+参数说明
+
+| 变量 | 类型 | 必填 | 注释 |
+| ------ | -------------- | ---- | ------------------------------------------------------------ |
+| text | string | 是 | 内容,例如:http://www.520yummy.com |
+| dst_x | number\|string | 否 | 画布位置x 特殊值 center 居中,居中并向左偏移 ['center',-5], 居中并向右偏移 ['center',5]; 支持百分比20% 支持自定义 支持正负 |
+| dst_y | number\|string | 否 | 画布位置y 特殊值 center 居中,居中并向上偏移 ['center',-5], 居中并向下偏移 ['center',5]; 支持百分比20% 支持自定义 支持正负 |
+| src_x | number | 否 | 图片x轴,默认0 |
+| src_y | number | 否 | 图片y轴,默认0 |
+| src_w | number | 否 | 图片自定义宽,默认原宽 |
+| src_h | number | 否 | 图片自定义高,默认原高 |
+| alpha | integer | 否 | 大小,默认4 |
+| margin | integer | 否 | 白边大小,默认1 |
+
+##### **批量合成二维码**
+
+```php
+$qrs = [
+ [
+ 'text' => $text,
+ 'dst_x' => $dst_x,
+ 'dst_y' => $dst_y,
+ 'src_x' => $src_x,
+ 'src_y' => $src_y,
+ 'src_w' => $src_w,
+ 'src_h' => $src_h,
+ 'size' => $size,
+ 'margin' => $margin
+ ]
+];
+$poster->buildQrMany($qrs); # 批量合成二维码
+```
+
+参数说明:与**合成二维码**参数一致。
+
+##### 合成线段
+
+```php
+$poster->buildLine($x1, $y1, $x2, $y2, $rgba, $type, $weight);
+```
+
+| 变量 | 类型 | 可选值 | 必填 | 注释 |
+| ------ | ------ | ------------------------------------------ | ---- | ------------------------------------------------------ |
+| x1 | int | | 是 | 起始点x坐标 |
+| y1 | int | | 是 | 起始点y坐标 |
+| x2 | int | | 是 | 结束点x坐标 |
+| y2 | int | | 是 | 结束点y坐标 |
+| rgba | array | | 否 | 默认透明 |
+| type | string | 默认line ( rectangle \| filled_rectangle ) | 否 | 默认线, rectangle 矩形, filled_rectangle 矩形并填充 |
+| weight | int | | 否 | 默认1粗细 |
+
+##### 合成圆弧
+
+```php
+$poster->buildArc($cx, $cy, $w, $h, $s, $e, $rgba, $type, $style, $weight);
+```
+
+| 变量 | 类型 | 可选值 | 必填 | 注释 |
+| ------ | ------ | ------------------------------------------------------------ | ---- | ----------------------------------- |
+| cx | int | | 是 | 原点x坐标 |
+| cy | int | | 是 | 原点y坐标 |
+| w | int | | 是 | 圆宽度 |
+| h | int | | 是 | 圆高度 |
+| s | int | | 是 | 起始点角度 |
+| e | int | | 是 | 结束点角度 |
+| rgba | array | | 否否 | 默认透明 |
+| type | string | 默认圆弧 ( filled_arc ) | 否 | 默认圆弧线, filled_arc 圆弧并填充 |
+| style | string | 默认**`IMG_ARC_PIE`**(**`IMG_ARC_PIE`** | **`IMG_ARC_CHORD`** | **`IMG_ARC_NOFILL`** | **`IMG_ARC_EDGED`**) | 否 | 填充类型才生效 |
+| weight | int | | 否 | 默认1粗细 |
+
+##### 合成文字
+
+```php
+// 可以用span标签的style color属性改变文字颜色,可用br标签换行
+$content = [
+ 'type' => 'html',
+ 'content' => '我是
某某,
我在贵阳
我为家乡助力
我用poster生成海报图片'
+];
+
+$poster->buildText($content,$dst_x,$dst_y,$font,$rgba,$max_w,$font_family,$weight,$space); # 合成文字
+
+// 新增文字宽度定位
+$dst_x = "center | left | right"; // 特殊值:center 居中 left 靠左 right 靠右
+$dst_x = ['center', 10]; // 居中且向右偏移10 负数向左偏移
+$dst_x = ['left', 10]; // 靠左且向右偏移10 负数向左偏移
+$dst_x = ['right', 10]; // 靠左且向右偏移10 负数向左偏移
+// 自定义宽度定位, center left right
+$dst_x = ['custom', 'center', 100, 200, 0]; // 在图像对象的x坐标100到200之间居中, 偏移0
+
+// 新增文字高度定位
+$dst_y = "center | top | bottom"; // 特殊值:center 居中 top 靠顶 bottom 靠底
+$dst_y = ['center', 10]; // 居中且向下偏移10 负数向上偏移
+$dst_y = ['top', 10]; // 靠顶且向下偏移10 负数向上偏移
+$dst_y = ['bottom', 10]; // 靠底且向下偏移10 负数向上偏移
+// 自定义高度定位, center top bottom
+$dst_y = ['custom', 'center', 100, 200, 0]; // 在图像对象的y坐标100到200之间居中, 偏移0
+```
+
+参数说明
+
+| 变量 | 类型 | 必填 | 注释 |
+| ----------- | --------------------- | ---- | ------------------------------------------------------------ |
+| content | string | 是 | 内容,例如:http://www.520yummy.com |
+| dst_x | number\|string\|array | 否 | 画布位置x ;特殊值 center 居中;居中并向左偏移 ['center',-5], 居中并向右偏移 ['center',5],上面注释 |
+| dst_y | number | 否 | 画布位置y,默认0 |
+| font | number | 否 | 字体大小,默认16 |
+| rgba | array | 否 | 颜色rbga,[255,255,255,1] |
+| max_w | number | 否 | 最大换行宽度,默认0不换行。达到换行宽度自动换行 |
+| font_family | string | 否 | 字体,可不填,有默认 (相对路径为项目根目录) |
+| weight | integer | 否 | 字体粗细 默认字体大小 |
+| space | integer | 否 | 字体间距 默认无 |
+| angle | integer | 否 | 旋转角度 |
+
+##### 批量合成文字
+
+```php
+$texts = [
+ [
+ 'content' => $content,
+ 'dst_x' => $dst_x,
+ 'dst_y' => $dst_y,
+ 'font' => $font,
+ 'rgba' => $rgba,
+ 'max_w' => $max_w,
+ 'font_family' => $font_family,
+ 'weight' => $weight,
+ 'space' => $space,
+ 'angle' => $angle,
+ ]
+];
+$poster->buildTextMany($texts); # 批量合成文字
+```
+
+参数说明:与**合成文字**参数一致。
+
+##### 获取海报
+
+```php
+$poster->getPoster($path = ''); # 获取合成后图片文件地址
+```
+
+参数说明:无。
+
+返回说明:返回数组,返回文件地址。
+
+##### 处理海报、图片
+
+```php
+$poster->setPoster(); # 处理图片,需要传原图片
+```
+
+参数说明:无。
+
+返回说明:处理原图片资源,无返回。
+
+##### 输出图片流
+
+```php
+$poster->stream(); # 输出图片流
+```
+
+参数说明:无。
+
+返回说明:返回文件流,可输出到浏览器或img标签。
+
+##### **输出base64**
+
+```php
+$poster->baseData(); # 返回base64
+```
+
+参数说明:无。
+
+返回说明:返回回base64,不保留在服务器直接使用。
+
+##### 生成二维码
+
+```php
+$qr = PosterManager::Poster()->Qr('http://www.520yummy.com','poster/1.png'); # 生成二维码
+```
+
+参数说明
+
+| 变量 | 类型 | 必填 | 注释 |
+| ------------ | --------------- | ---- | ------------------------------------------------------------ |
+| text | string | 是 | 二维码包含的内容,可以是链接、文字、json字符串等等,例如:http://www.520yummy.com |
+| outfile | boolean\|string | 否 | 默认为false,不生成文件,只将二维码图片返回输出;否则需要给出存放生成二维码图片的文件名及路径 |
+| level | string | 否 | 容错级别,默认为L, 可传递的值分别是L(QR_ECLEVEL_L,7%)、M(QR_ECLEVEL_M,15%)、Q(QR_ECLEVEL_Q,25%)、H(QR_ECLEVEL_H,30%)。这个参数控制二维码容错率,不同的参数表示二维码可被覆盖的区域百分比,也就是被覆盖的区域还能识别 |
+| size | integer | 否 | 控制生成图片的大小,默认为4 |
+| margin | integer | 否 | 控制生成二维码的空白区域大小,默认4 |
+| saveandprint | boolean | 否 | 保存二维码图片并显示出来,outfile 必须传递图片路径,默认false |
+
+返回说明:outfile 为空,输出二维码图片,不生成文件;否则返回图片路径。
+
+#### HTML转图片、PDF
+
+> 需要安装 wkhtmltopdf 工具,下载地址 https://wkhtmltopdf.org/downloads.html
+>
+> 注意:css 以 -webkit 标准执行
+
+##### **调用Html类**
+
+```php
+use Kkokk\Poster\Facades\Html;
+```
+
+##### **加载html**
+
+```php
+$html = <<
+
+
+
+
+
+ 你好
+
+
+
+
+
你好,世界
+
+
+
+eol;
+/**
+ * @param string $html html文件路径、链接、html字符串
+ */
+$html = Html::load($html);
+```
+
+##### **输出类型**
+
+```php
+/**
+ * @param string $type 默认png,值范围为常规图片类型,PDF
+ */
+$html->type($type);
+```
+
+##### **工具原生命令**
+
+```php
+/**
+ * @param string $command 工具原生命令 如 --version
+ */
+$html->command($command);
+```
+
+##### **设置尺寸**
+
+```php
+/**
+ * @param int $width 指定宽度
+ * @param int $height 指定高度
+ */
+$html->size($width, $height);
+```
+
+##### **剪裁**
+
+```php
+/**
+ * @param int $crop_w 剪裁宽度
+ * @param int $crop_h 剪裁高度
+ * @param int $crop_x 从x点开始剪裁
+ * @param int $crop_y 从y点开始剪裁
+ */
+$html->crop($crop_w, $crop_h, $crop_x, $crop_y);
+```
+
+##### **设置背景透明**
+
+```php
+$html->transparent();
+```
+
+##### **设置图片质量**
+
+```php
+/**
+ * @param int $quality 0-100
+ */
+$html->quality($quality)
+```
+
+##### **设置输出地址**
+
+```php
+/**
+ * @param string $path 指定保存文件路径,包含文件名
+ * @param string $type 默认png 这里和type方法一致
+ */
+$html->output($path, $type);
+```
+
+##### **渲染**
+
+```php
+/**
+ * @return Html Html对象
+ */
+$htmlObj = $html->render();
+```
+
+##### **获取二进制流**
+
+```php
+$blob = $htmlObj->getImageBlob();
+```
+
+##### **获取保存文件**
+
+```php
+$file = $htmlObj->getFilePath();
+```
+
+##### **完整示例**
+
+```php
+use Kkokk\Poster\Facades\Html;
+
+$htmlObj = Html::load($html)->transparent()->size(338, 426)->render();
+
+// 流文件
+$blob = $htmlObj->getImageBlob();
+// 文件地址
+$file = $htmlObj->getFilePath();
+
+```
+
+##### 和生成海报的合成图片配合使用
+
+```php
+use Kkokk\Poster\Facades\Poster;
+use Kkokk\Poster\Facades\Html;
+
+// $html 用上面的代码这里省略...
+Poster::extension('gd')
+ ->buildIm(638, 826, [41, 43, 48, 127], false)
+ ->buildImage([
+ 'src' => Html::load($html)->transparent()->size(338, 426)->render()->getImageBlob(),
+ 'angle' => 0
+ ], 'center', 'center')
+ ->buildImage([
+ 'src' => 'https://portrait.gitee.com/uploads/avatars/user/721/2164500_langlanglang_1601019617.png',
+ 'angle' => 80
+ ], 253, 326, 0, 0, 131, 131, false, 'circle')
+ ->buildText('苏轼', 'center', 477, 16, [255, 255, 255, 1])
+ ->buildText('明月几时有,把酒问青天。不知天上宫阙,今夕是何年。', 'center', 515, 14, [255, 255, 255, 1])
+ ->stream();
+
+// 以上将把 wkhtmltopdf 生成的图片合成到海报中,并输出为流文件
+```
+
+#### 生成验证码图片
+
+##### 滑块图片验证
+
+```php
+# 自定义参数
+$params = [
+ 'src' => '', // 背景图片,尺寸 340 * 191
+ 'im_width' => 340, // 画布宽度
+ 'im_height' => 251, // 画布高度
+ 'im_type' => 'png', // png 默认 jpg quality 质量
+ 'quality' => 80, // jpg quality 质量
+ 'bg_width' => 340, // 背景宽度
+ 'bg_height' => 191, // 背景高度
+ 'slider_width' => 50, // 滑块宽度
+ 'slider_height' => 50, // 滑块高度
+ 'slider_border' => 2, // 滑块边框
+ 'slider_bg' => 1, // 滑块背景数量
+];
+
+$type = 'slider';
+
+/**
+ * 获取验证参数
+ * 内部使用了 laravel 的 cache 缓存,返回的是图片的 base64 、 缓存key 、滑块高度
+ * @param string $type 验证码类型
+ * @param array $params 验证码自定义参数
+ * @return arary
+ */
+$data = PosterManager::Captcha()->type($type)->config($params)->get();
+
+/**
+ * 验证
+ * 前端根据相关滑块操作进行处理, 返回x坐标,返回 true 则验证成功
+ * @param string $key 缓存key
+ * @param string|int $value 前端传回来的x坐标
+ * @param int $leeway 误差值
+ * @return boolean
+ */
+$res = PosterManager::Captcha()->type($type)->check($key, $value, $leeway);
+```
+
+##### 旋转图片验证
+
+```php
+# 自定义参数
+$params = [
+ 'src' => '', // 背景图片,尺寸 350 * 350 正方形都可
+ 'im_width' => 350, // 画布宽度
+ 'im_height' => 350, // 画布高度
+ 'im_type' => 'png', // png 默认 jpg quality 质量
+ 'quality' => 80, // jpg quality 质量
+ ];
+
+$type = 'rotate';
+
+/**
+ * 获取验证参数
+ * 内部使用了 laravel 的 cache 缓存,返回的是图片的 base64 、 缓存key
+ * @param string $type 验证码类型
+ * @param array $params 验证码自定义参数
+ * @return arary
+ */
+$data = PosterManager::Captcha()->type($type)->config($params)->get();
+
+/**
+ * 验证
+ * 前端根据相关滑块操作进行处理, 返回x坐标,返回 true 则验证成功
+ * @param string $key 缓存key
+ * @param string|int $value 前端传回来的旋转角度
+ * @param int $leeway 误差值
+ * @return boolean
+ */
+$res = PosterManager::Captcha()->type($type)->check($key, $value, $leeway);
+```
+
+##### 点击图片验证
+
+```php
+# 自定义参数
+$params = [
+ 'src' => '',
+ 'im_type' => 'png', // png 默认 jpg quality 质量
+ 'quality' => 80, // jpg quality 质量
+ 'font_family' => '', // 感谢站酷提供免费商用站酷库黑体、可自定义炫酷字体文件(绝对路径)
+ 'contents' => '', // 自定义文字
+ 'font_count' => 0, // 文字长度
+ 'font_size' => 42, // 字体大小
+ 'line_count' => 0, // 干扰线数量
+ 'char_count' => 0, // 干扰字符数量
+ ];
+
+$type = 'click';
+
+/**
+ * 获取验证参数
+ * 内部使用了 laravel 的 cache 缓存,返回的是图片的 base64 、 缓存key
+ * @param string $type 验证码类型
+ * @param array $params 验证码自定义参数
+ * @return arary
+ */
+$data = PosterManager::Captcha()->type($type)->config($params)->get();
+
+/**
+ * 验证
+ * 前端根据相关点击操作进行处理, 返回点击坐标数组,返回 true 则验证成功
+ * @param string $key 缓存key
+ * @param string|int|array $value 前端传回来的坐标数组
+ * @return boolean
+ */
+$res = PosterManager::Captcha()->type($type)->check($key, $value);
+```
+
+##### 手动输入验证
+
+```php
+# 自定义参数
+$params = [
+ 'src' => '',
+ 'im_width' => 256,
+ 'im_height' => 64,
+ 'im_type' => 'png', // png 默认 jpg quality 质量
+ 'quality' => 80, // jpg quality 质量
+ 'type' => 'number', // type = number 数字 alpha_num 字母和数字 math 计算 text 文字
+ 'font_family' => '', // 可自定义炫酷字体文件
+ 'font_size' => 32, // 字体大小
+ 'font_count' => 4, // 字体长度
+ 'line_count' => 5, // 干扰线数量
+ 'char_count' => 10, // 干扰字符数量
+ ];
+
+$type = 'click';
+
+/**
+ * 获取验证参数
+ * 内部使用了 laravel 的 cache 缓存,返回的是图片的 base64 、 缓存key
+ * @param string $type 验证码类型
+ * @param array $params 验证码自定义参数
+ * @return arary
+ */
+$data = PosterManager::Captcha()->type($type)->config($params)->get();
+
+/**
+ * 验证
+ * 前端根据相关输入, 返回输入结果,返回 true 则验证成功
+ * @param string $key 缓存key
+ * @param string|int|array $value 输入结果
+ * @return boolean
+ */
+$res = PosterManager::Captcha()->type($type)->check($key, $value);
+```
+
+#### 示例
+
+##### 图片验证
+
+```php
+ use Kkokk\Poster\PosterManager;
+ use Kkokk\Poster\Exception\PosterException;
+
+ try {
+ # 滑块验证
+ $type = 'slider';
+ $data = PosterManager::Captcha()->type($type)->get();
+ $res = PosterManager::Captcha()->type($type)->check($key, $value);
+
+ # 旋转图片验证
+ $type = 'rotate';
+ $data = PosterManager::Captcha()->type($type)->get();
+ $res = PosterManager::Captcha()->type($type)->check($key, $value);
+
+ # 点击验证
+ $type = 'click';
+ $data = PosterManager::Captcha()->type($type)->get();
+ $res = PosterManager::Captcha()->type($type)->check($key, $value);
+
+ # 输入验证
+ $type = 'input';
+ $data = PosterManager::Captcha()->type($type)->get();
+ $res = PosterManager::Captcha()->type($type)->check($key, $value);
+
+ } catch (PosterException $e) {
+ print_r($e->getMessage())
+ }
+```
+
+##### 海报类门面调用
+
+```php
+use Kkokk\Poster\PosterManager;
+use Kkokk\Poster\Exception\Exception;
+# 合成图片
+try {
+ $result = Poster::extension('gd')
+ ->config([
+ 'path' => __DIR__ . '/../poster/test1.png',
+ // 'font' => 'static/simkai.ttf',
+ // 'dpi' => 72
+ ])
+ ->buildIm(638, 826, [255, 255, 255, 127], false)
+ // ->buildImage('https://test.acyapi.51acy.com/wechat/poster/top_bg.png')
+ // ->buildImage('static/top_bg.png')
+ // ->buildImage('https://test.acyapi.51acy.com/wechat/poster/half_circle.png', 254, 321)
+ // ->buildImage('https://portrait.gitee.com/uploads/avatars/user/721/2164500_langlanglang_1601019617.png', 253, 326, 0, 0, 131, 131, false, 'circle')
+ // ->buildImage('https://test.acyapi.51acy.com/wechat/poster/fengexian.png', 0, 655)
+ // ->buildImage('https://test.acyapi.51acy.com/wechat/qrcode/poster_241.jpg',37,692,0,0,122,122)
+ ->buildText('明月几时有,把酒问青天', ['center'], 200, 20, [52, 52, 52, 2], 0, '', 1, 40)
+ ->buildText('明月几时有,把酒问青天', ['center'], 300, 20, [52, 52, 52, 2], 0, '', 1, 40)
+ ->buildText('苏轼', 'center', 477, 16, [51, 51, 51, 1])
+ ->buildText('明月几时有,把酒问青天。不知天上宫阙,今夕是何年。', 'center', 515, 14, [153, 153, 153, 1])
+ ->buildText('长按识别', 497, 720, 15, [153, 153, 153, 1])
+ ->buildText('查看TA的更多作品', 437, 757, 15, [153, 153, 153, 1])
+ ->buildQr('http://www.baidu.com', 37, 692, 0, 0, 122, 122)
+ ->buildBg(400, 500, ['color' => [
+ [255, 0, 0],
+ [255, 125, 0],
+ [255, 255, 0],
+ [0, 255, 0],
+ [0, 255, 255],
+ [0, 0, 255],
+ [255, 0, 255]
+ ], 'alpha' => 80, 'to' => 'top', 'radius' => '20 30 40 80'], true, 'center', 'center', 0, 0,
+ function ($im) {
+ // $im->buildImage('https://test.acyapi.51acy.com/wechat/poster/top_bg.png');
+ $im->buildLine(10, 100, 100, 200, [0, 0, 0, 1], '', 10);
+ // $im->buildLine(10, 30, 100, 100, [0, 0, 0, 1], 'rectangle', 10);
+ // $im->buildLine(120, 10, 220, 100, [0, 0, 0, 1], 'filled_rectangle', 10);
+ $im->buildArc(200, 200, 50, 50, 0, 360, [0, 0, 0, 1], '', 1);
+ $im->buildText('明月几时有,把酒问青天,不知天上宫阙,今夕是何年', 'center', ['custom', 'center', 0, 100, 0], 20, [0, 0, 0, 50], 0, '', 1, 0);
+ // $im->buildText('明月几时有', ['custom', 'right', 200, 400], ['custom', 'bottom', 200, 500, -20], 20, [0, 0, 0, 50]);
+ })
+ ->getPoster();
+} catch (Exception $e){
+ echo $e->getMessage();
+}
+```
+
+
+
+##### 海报类静态调用
+
+```php
+use Kkokk\Poster\PosterManager;
+use Kkokk\Poster\Exception\Exception;
+# 合成图片
+try {
+ $addImage = "https://portrait.gitee.com/uploads/avatars/user/721/2164500_langlanglang_1601019617.png";
+ $result = PosterManager::Poster('poster/poster_user') //生成海报,这里写保存路径和文件名,可以指定图片后缀。默认png
+ ->buildIm(638,826,[255,255,255,127],false)
+ ->buildImage('https://test.acyapi.51acy.com/wechat/poster/top_bg.png')
+ ->buildImage('https://test.acyapi.51acy.com/wechat/poster/half_circle.png',254,321)
+ ->buildImage($addImage,253,326,0,0,131,131,false,'circle')
+ ->buildImage('https://test.acyapi.51acy.com/wechat/poster/fengexian.png',0,655)
+ ->buildText('苏 轼','center',477,16,[51, 51, 51,1])
+ ->buildText('明月几时有,把酒问青天。不知天上宫阙,今夕是何年。','center',515,14,[53, 53, 53, 1])
+ ->buildText('我欲乘风归去,又恐琼楼玉宇,高处不胜寒。','center',535,14,[53, 153, 153, 1])
+ ->buildText('起舞弄清影,何似在人间。转朱阁,低绮户,照无眠。','center',555,14,[53, 153, 153, 1])
+ ->buildText('不应有恨,何事长向别时圆?','center',575,14,[53, 153, 153, 1])
+ ->buildText('人有悲欢离合,月有阴晴圆缺,此事古难全。','center',595,14,[53, 153, 153, 1])
+ ->buildText('但愿人长久,千里共婵娟。','center',615,14,[53, 153, 153, 1])
+ ->buildText('长按识别',497,720,15,[53, 153, 153, 1])
+ ->buildText('查看TA的更多作品',413,757,15,[53, 153, 153, 1])
+ ->buildQr('http://www.520yummy.com',37,692,0,0,0,0,4,1)
+ ->getPoster();
+
+ # 批量合成
+ $buildImageManyArr = [
+ [
+ 'src' => 'https://test.acyapi.51acy.com/wechat/poster/top_bg.png'
+ ],
+ ];
+ $buildTextManyArr = [
+ [
+ 'content'=> '明月几时有,把酒问青天。不知天上宫阙,今夕是何年。',
+ 'dst_x' => 'center',
+ 'dst_y' => 515,
+ 'font' => 16,
+ 'rgba' => [51, 51, 51, 1],
+ 'max_w'=> 0,
+ 'font_family' => '',
+ 'weight' => 1,
+ 'space'=>20
+ ],
+ ];
+ $buildQrManyArr = [
+ [
+ 'text'=>'http://www.520yummy.com',
+ 'dst_x'=>37,
+ 'dst_y'=>692,
+ 'src_x'=>0,
+ 'src_y'=>0,
+ 'src_w'=>0,
+ 'src_h'=>0,
+ 'size'=>4,
+ 'margin'=>1
+ ],
+ ];
+
+ $result = PosterManager::Poster('poster/poster_user')
+ ->buildIm(638,826,[255,255,255,127],false)
+ ->buildImageMany($buildImageManyArr)
+ ->buildTextMany($buildImageManyArr)
+ ->buildQrMany($buildQrManyArr)
+ ->buildBg(400,526,
+ ['color'=>[[0,0,162], [0,255,162], [255,255,162], [255, 0, 0], [0, 255, 0]],
+ 'alpha'=>50,
+ 'to'=>'bottom'
+ ],
+ true,
+ ['center', -10],
+ ['center', 10],
+ 0,
+ 0 ,
+ function($im){
+ $im->buildText('明月几时有,把酒问青天。不知天上宫阙,今夕是何年。','center',100,20,[255, 255, 255, 50]);
+ }
+ )->getPoster();
+
+ # 给图片添加水印
+ $setImage = "https://portrait.gitee.com/uploads/avatars/user/721/2164500_langlanglang_1601019617.png";
+ $result = PosterManager::Poster() //给指定图片添加水印,这里为空就好
+ ->buildImDst(__DIR__.'/test.jpeg')
+ ->buildImage($setImage,'-20%','-20%',0,0,0,0,false)
+ ->setPoster();
+
+ # 生成二维码
+ $result = PosterManager::Poster()->Qr('http://www.baidu.com','poster/1.png');
+} catch (Exception $e){
+ echo $e->getMessage();
+}
+```
+
+##### 海报类实例化调用
+```php
+use Kkokk\Poster\PosterManager;
+use Kkokk\Poster\Exception\Exception;
+# 合成图片
+try {
+ $addImage = "https://portrait.gitee.com/uploads/avatars/user/721/2164500_langlanglang_1601019617.png";
+ $PosterManager = new PosterManager('poster/poster_user'); //生成海报,这里写保存路径和文件名,可以指定图片后缀。默认png
+ $result = $PosterManager->buildIm(638,826,255,255,255,1]27,false)
+ ->buildIm(638,826,[255,255,255,127],false)
+ ->buildImage('https://test.acyapi.51acy.com/wechat/poster/top_bg.png')
+ ->buildImage('https://test.acyapi.51acy.com/wechat/poster/half_circle.png',254,321)
+ ->buildImage($addImage,253,326,0,0,131,131,false,'circle')
+ ->buildImage('https://test.acyapi.51acy.com/wechat/poster/fengexian.png',0,655)
+ ->buildText('苏 轼','center',477,16,[51, 51, 51,1])
+ ->buildText('明月几时有,把酒问青天。不知天上宫阙,今夕是何年。','center',515,14,[53, 53, 53, 1])
+ ->buildText('我欲乘风归去,又恐琼楼玉宇,高处不胜寒。','center',535,14,[53, 153, 153, 1])
+ ->buildText('起舞弄清影,何似在人间。转朱阁,低绮户,照无眠。','center',555,14,[53, 153, 153, 1])
+ ->buildText('不应有恨,何事长向别时圆?','center',575,14,[53, 153, 153, 1])
+ ->buildText('人有悲欢离合,月有阴晴圆缺,此事古难全。','center',595,14,[53, 153, 153, 1])
+ ->buildText('但愿人长久,千里共婵娟。','center',615,14,[53, 153, 153, 1])
+ ->buildText('长按识别',497,720,15,[53, 153, 153, 1])
+ ->buildText('查看TA的更多作品',413,757,15,[53, 153, 153, 1])
+ ->buildQr('http://www.520yummy.com',37,692,0,0,0,0,4,1)
+ ->getPoster();
+
+ # 给图片添加水印
+ $setImage = 'https://portrait.gitee.com/uploads/avatars/user/721/2164500_langlanglang_1601019617.png';
+ $PosterManager = new PosterManager(); //给指定图片添加水印,这里为空就好
+ $result = $PosterManager->buildImDst(__DIR__.'/test.jpeg')
+ ->buildImage($setImage,'center','-20%',0,0,0,0,true)
+ ->setPoster();
+
+ # 生成二维码
+ $result = $PosterManager->Qr('http://www.baidu.com','poster/1.png');
+
+} catch (Exception $e){
+ echo $e->getMessage();
+}
+```
diff --git a/niucloud/vendor/kkokk/poster/composer.json b/niucloud/vendor/kkokk/poster/composer.json
new file mode 100644
index 000000000..2223d3cbb
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/composer.json
@@ -0,0 +1,30 @@
+{
+ "name": "kkokk/poster",
+ "description": "PHP生成海报",
+ "type": "project",
+ "require": {
+ "php": ">=5.6.0",
+ "ext-gd": "*",
+ "ext-iconv": "*",
+ "ext-mbstring": "*",
+ "ext-json": "*"
+ },
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "lang",
+ "email": "732853989@qq.com"
+ }
+ ],
+ "minimum-stability": "dev",
+ "autoload":{
+ "psr-4":{
+ "Kkokk\\Poster\\":"src/"
+ }
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "Kkokk\\Tests\\": "tests/"
+ }
+ }
+}
diff --git a/niucloud/vendor/kkokk/poster/src/Cache/Repository.php b/niucloud/vendor/kkokk/poster/src/Cache/Repository.php
new file mode 100644
index 000000000..3d7966bd7
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Cache/Repository.php
@@ -0,0 +1,34 @@
+createGenerator($name);
+ }
+
+ protected function createGenerator($name)
+ {
+ switch ($name) {
+ case 'input':
+ return new Generators\InputGenerator(); // 输入类验证
+ case 'click':
+ return new Generators\ClickGenerator(); // 点击验证
+ case 'rotate':
+ return new Generators\RotateGenerator(); // 旋转验证
+ case 'slider':
+ return new Generators\SliderGenerator(); // 滑块验证
+ }
+
+ throw new PosterException("Unsupported Captcha Generator [{$name}].");
+ }
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/Captcha/CaptchaGeneratorInterface.php b/niucloud/vendor/kkokk/poster/src/Captcha/CaptchaGeneratorInterface.php
new file mode 100644
index 000000000..0660a81ec
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Captcha/CaptchaGeneratorInterface.php
@@ -0,0 +1,50 @@
+factory = new CaptchaGeneratorFactory();
+ }
+
+ /**
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2023/3/29
+ * Time: 14:58
+ * @param null $name
+ * @return CaptchaGenerator
+ */
+ public function type($name = null)
+ {
+ $name = $this->parseChannelName($name);
+
+ if (!isset($this->extensions[$name])) {
+ $this->channels[$name] = $this->configure($this->makeGenerator($name));
+ }
+
+ return $this->channels[$name];
+ }
+
+ protected function configure(CaptchaGenerator $generator)
+ {
+ return $generator;
+ }
+
+ protected function parseChannelName($name)
+ {
+ if (empty($name)) return $this->supportedGenerators()[0];
+ return $name;
+ }
+
+ protected function makeGenerator($name)
+ {
+ return $this->factory->make($name);
+ }
+
+ /**
+ * 获取所有支持方法。
+ *
+ * @return array
+ */
+ public function supportedGenerators()
+ {
+ return ['slider', 'click', 'rotate', 'input'];
+ }
+
+ /**
+ * 将方法动态传递给默认方法。
+ *
+ * @param string $method
+ * @param array $parameters
+ * @return mixed
+ */
+ public function __call($method, $parameters)
+ {
+ return $this->type()->$method(...$parameters);
+ }
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/Captcha/Generators/CaptchaGenerator.php b/niucloud/vendor/kkokk/poster/src/Captcha/Generators/CaptchaGenerator.php
new file mode 100644
index 000000000..c59a88788
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Captcha/Generators/CaptchaGenerator.php
@@ -0,0 +1,240 @@
+PosterDriver = new GdDriver();
+ $this->Common = new Common;
+ }
+
+ /**
+ * 转base64
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2022/12/15
+ * Time: 10:38
+ * @param $im
+ * @param string $type
+ * @return string
+ */
+ protected function baseData($im, $type = 'png')
+ {
+ return $this->Common->baseData($im, $type);
+ }
+
+ public function imOutput($im, $type = 'png', $quality = 75, $filename = 'im')
+ {
+ $yes = 0; // 控制是否生成图片,测试时方便查看
+ $dir = __DIR__ . '/../../../tests/poster/' . $filename . '.' . $this->configs['im_type'];
+ return $yes && $this->Common->imOutput($im, $dir, $type, $quality);
+ }
+
+ public function getCross($p1, $p2, $p)
+ {
+ return $this->Common->getCross($p1, $p2, $p);
+ }
+
+ // 获取缓存
+ public function getCache($key)
+ {
+ try {
+ $contents = Cache::pull($key);
+ } catch (PosterException $e) {
+ // 如果未定义缓存器则返回false, 需要传递自行保存的密码进行比对
+ return false;
+ } catch (\Exception $e) {
+ // 报错,则返回false, 需要传递自行保存的密码进行比对
+ return false;
+ }
+ return $contents;
+ }
+
+ // 设置缓存
+ public function setCache($key, $value, $expire)
+ {
+ try {
+ Cache::put($key, $value, $expire ?: $this->expire);
+ } catch (PosterException $e) {
+ // 未查询到缓存器,则返回密码,自行保存
+ return false;
+ } catch (\Exception $e) {
+ // 报错,则返回密码,自行保存
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * 画布填充图片
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2022/12/15
+ * Time: 10:37
+ * @param string $src
+ * @param false $resize
+ * @param int $dst_x
+ * @param int $dst_y
+ * @param int $src_x
+ * @param int $src_y
+ * @param int $src_width
+ * @param int $src_height
+ * @throws PosterException
+ */
+ protected function drawImage($src = '', $resize = false, $dst_x = 0, $dst_y = 0, $src_x = 0, $src_y = 0, $src_width = 0, $src_height = 0)
+ {
+ $src = $src ?: $this->getImBg();
+
+ list($Width, $Height, $bgType) = @getimagesize($src);
+
+ $Width = $src_width ?: $Width;
+ $Height = $src_height ?: $Height;
+
+ $bgType = image_type_to_extension($bgType, false);
+
+ if (empty($bgType)) throw new PosterException('image resources cannot be empty (' . $src . ')');
+
+ $getGdVersion = preg_match('~\((.*) ~', gd_info()['GD Version'], $matches);
+ if ($getGdVersion && (float)$matches[1] < 2 && $bgType == 'gif') {
+ $pic = imagecreatefromstring(file_get_contents($src));
+ } else {
+ $fun = 'imagecreatefrom' . $bgType;
+ $pic = @$fun($src);
+ }
+
+ if ($resize) {
+ imagecopyresized($this->im, $pic, $dst_x, $dst_y, $src_x, $src_y, $this->configs['im_width'], $this->configs['im_height'], $Width, $Height);
+ } else {
+ imagecopy($this->im, $pic, $dst_x, $dst_y, $src_x, $src_y, $Width, $Height);
+ }
+ $this->destroyImage($pic);
+ }
+
+ /**
+ * 干扰线
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2022/12/15
+ * Time: 10:37
+ * @param int $width
+ * @param int $height
+ * @throws PosterException
+ */
+ public function drawLine($width = 0, $height = 0)
+ {
+ $lineCount = $this->configs['line_count'];
+
+ if ($lineCount > 0) {
+ $im_width = $width ?: $this->configs['im_width'];
+ $im_height = $height ?: $this->configs['im_height'];
+
+ for ($i = 0; $i <= $lineCount; $i++) {
+ $color = $this->PosterDriver->createColorAlpha($this->im, [mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255), 1]);
+ $x1 = mt_rand(0, $im_width);
+ $y1 = mt_rand(0, $im_height);
+ $x2 = mt_rand(0, $im_width);
+ $y2 = mt_rand(0, $im_height);
+ imageline($this->im, $x1, $y1, $x2, $y2, $color);
+ }
+
+ imageantialias($this->im, true);
+ }
+ }
+
+ /**
+ * 干扰文字
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2022/12/15
+ * Time: 10:37
+ * @param int $width
+ * @param int $height
+ * @throws PosterException
+ */
+ public function drawChar($width = 0, $height = 0)
+ {
+ $charCount = $this->configs['char_count'];
+
+ if ($charCount > 0) {
+ $font_family = $this->configs['font_family'];
+ $font = $this->configs['font_size'] / 2;
+
+ $contents = $this->getChar($this->configs['type']);
+
+ $color = $this->PosterDriver->createColorAlpha($this->im, [255, 255, 255, 1]);
+
+ $im_width = $width ?: $this->configs['im_width'];
+ $im_height = $height ?: $this->configs['im_height'];
+
+ for ($i = 0; $i < $charCount; $i++) {
+ $content = mb_substr($contents, mt_rand(0, mb_strlen($contents) - 1), 1);
+ $x = mt_rand($font, $im_width - $font);
+ $y = mt_rand($font, $im_height - $font);
+ $angle = mt_rand(0, 45);
+ imagettftext($this->im, $font, $angle, $x, $y, $color, $font_family, $content);
+ }
+ }
+ }
+
+ public function getChar($type)
+ {
+ switch ($type) {
+ case 'text':
+ $str = '的一是在不了有和人这中大为上个国我以要他时来用们生到作地于出就分对成会可主发年动同工也能下过子说产种面而方后多定行学法所民得经十三之进着等部度家电力里如水化高自二理起小物现实加量都两体制机当使点从业本去把性好应开它合还因由其些然前外天政四日那社义事平形相全表间样与关各重新线内数正心反你明看原又么利比或但质气第向道命此变条只没结解问意建月公无系军很情者最立代想已通并提直题党程展五果料象员革位入常文总次品式活设及管特件长求老头基资边流路级少图山统接知较将组见计别她手角期根论运农指几九区强放决西被干做必战先回则任取据处队南给色光门即保治北造百规热领七海口东导器压志世金增争济阶油思术极交受联什认六共权收证改清己美再采转更单风切打白教速花带安场身车例真务具万每目至达走积示议声报斗完类八离华名确才科张信马节话米整空元况今集温传土许步群广石记需段研界拉林律叫且究观越织装影算低持音众书布复容儿须际商非验连断深难近矿千周委素技备半办青省列习响约支般史感劳便团往酸历市克何除消构府称太准精值号率族维划选标写存候毛亲快效斯院查江型眼王按格养易置派层片始却专状育厂京识适属圆包火住调满县局照参红细引听该冯价严龙飞';
+ break;
+ case 'alpha_num':
+ $str = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
+ break;
+ case 'math':
+ case 'number':
+ $str = '1234567890';
+ break;
+ default:
+ $str = 'abcdefghijklmnopqrstuvwxyz';
+ break;
+ }
+
+ return $str;
+ }
+
+ /**
+ * 释放resource
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2022/12/15
+ * Time: 10:38
+ * @param $Resource
+ */
+ protected function destroyImage($Resource)
+ {
+
+ !is_resource($Resource) || imagedestroy($Resource);
+ }
+
+ /**
+ * 析构方法,用于销毁 im 图像资源
+ */
+ public function __destruct()
+ {
+ empty($this->im) || !is_resource($this->im) || imagedestroy($this->im);
+ }
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/Captcha/Generators/ClickGenerator.php b/niucloud/vendor/kkokk/poster/src/Captcha/Generators/ClickGenerator.php
new file mode 100644
index 000000000..60f7d38d6
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Captcha/Generators/ClickGenerator.php
@@ -0,0 +1,129 @@
+ '',
+ 'im_width' => 256,
+ 'im_height' => 306,
+ 'im_type' => 'png', // png 默认 jpg quality 质量
+ 'quality' => 80, // jpg quality 质量
+ 'bg_width' => 256,
+ 'bg_height' => 256,
+ 'type' => 'text', // text 汉字 number 数字 alpha_num 字母和数字
+ 'font_family' => __DIR__ . DIRECTORY_SEPARATOR .'..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'style' . DIRECTORY_SEPARATOR . 'zhankukuheiti.ttf', // 感谢站酷提供免费商用站酷库黑体、可自定义炫酷字体文件(绝对路径)
+ 'contents' => '', // 自定义文字
+ 'font_size' => 42, // 字体大小
+ 'font_count' => 0, // 字体大小
+ 'line_count' => 0, // 干扰线数量
+ 'char_count' => 0, // 干扰字符数量
+ ]; // 验证码图片配置
+
+ /**
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2023/3/29
+ * Time: 15:06
+ * @param array $params
+ * @return $this|CaptchaGenerator
+ */
+ public function config($params = [])
+ {
+ if (empty($params)) return $this;
+ $this->configs['src'] = isset($params['src']) ? $params['src'] : $this->configs['src'];
+ $this->configs['im_type'] = isset($params['im_type']) ? $params['im_type'] : $this->configs['im_type'];
+ $this->configs['quality'] = isset($params['quality']) ? $params['quality'] : $this->configs['quality'];
+ $this->configs['contents'] = isset($params['contents']) ? $params['contents'] : $this->configs['contents'];
+ $this->configs['font_family'] = isset($params['font_family']) ? $params['font_family'] : $this->configs['font_family'];
+ $this->configs['font_size'] = isset($params['font_size']) ? $params['font_size'] : $this->configs['font_size'];
+ $this->configs['font_count'] = isset($params['font_count']) ? $params['font_count'] : $this->configs['font_count'];
+ $this->configs['line_count'] = isset($params['line_count']) ? $params['line_count'] : $this->configs['line_count'];
+ $this->configs['char_count'] = isset($params['char_count']) ? $params['line_count'] : $this->configs['char_count'];
+ if ($this->configs['contents']) $this->configs['font_count'] = mb_strlen($this->configs['contents']);
+ return $this;
+ }
+
+ public function check($key, $value, $leeway = 0, $secret = null)
+ {
+ if (!is_array($value)) throw new PosterException('array format required');
+
+ $contents = $this->getCache($key) ?: $secret;
+
+ if (!$contents) return false;
+
+ if (!is_array($contents)) {
+ $points = json_decode($contents, true);
+ } else {
+ $points = $contents;
+ }
+
+ if (count($points) != count($value)) return false;
+
+ foreach ($points as $k => $v) {
+ $point = $v['point'];
+
+ // 任意坐标点
+ $p = [$value[$k]['x'], $value[$k]['y']];
+ $p1 = [$point[0], $point[1]]; // 左下
+ $p2 = [$point[2], $point[3]]; // 右下
+ $p3 = [$point[4], $point[5]]; // 右上
+ $p4 = [$point[6], $point[7]]; // 左上
+
+ // 叉积计算 点在四条平行线内部则是在矩形内 p1->p2 p1->p3 参考点 p1 叉积大于0点p3在p2逆时针方向 等于0 三点一线 小于0 点p3在p2顺时针防线
+ $isCross = $this->getCross($p1, $p2, $p) * $this->getCross($p3, $p4, $p) >= 0 && $this->getCross($p2, $p3, $p) * $this->getCross($p4, $p1, $p) >= 0;
+ if ($isCross) {
+ continue;
+ } else {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public function get($expire = 0)
+ {
+
+ $data = $this->draw();
+
+ $this->imOutput(
+ $this->im,
+ $this->configs['im_type'],
+ $this->configs['quality'],
+ 'click'
+ );
+
+ $baseData = $this->baseData($this->im, $this->configs['im_type']);
+
+ $key = uniqid('click' . mt_rand(0, 9999), true);
+
+ $res = [
+ 'key' => $key,
+ 'img' => $baseData,
+ 'content_width' => $data['content_width'],
+ 'content_height' => $data['content_height'],
+ 'x' => $data['x'],
+ 'y' => $data['y'],
+ ];
+
+ $setCache = $this->setCache($key, json_encode($data['contents']), $expire);
+ if (!$setCache) $res['secret'] = json_encode($data['contents']);
+
+ return $res;
+ }
+
+}
diff --git a/niucloud/vendor/kkokk/poster/src/Captcha/Generators/InputGenerator.php b/niucloud/vendor/kkokk/poster/src/Captcha/Generators/InputGenerator.php
new file mode 100644
index 000000000..47b5482f2
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Captcha/Generators/InputGenerator.php
@@ -0,0 +1,91 @@
+ '',
+ 'im_width' => 256,
+ 'im_height' => 64,
+ 'im_type' => 'png', // png 默认 jpg quality 质量
+ 'quality' => 80, // jpg quality 质量
+ 'type' => 'number', // type = number 数字 alpha_num 字母和数字 math 计算 text 文字
+ 'font_family' => __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'style' . DIRECTORY_SEPARATOR . 'simkai.ttf', // 感谢站酷提供免费商用站酷库黑体、可自定义炫酷字体文件
+ 'font_size' => 32, // 字体大小
+ 'font_count' => 4, // 字体长度
+ 'line_count' => 5, // 干扰线数量
+ 'char_count' => 10, // 干扰字符数量
+ ];
+
+ /**
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2023/3/29
+ * Time: 15:06
+ * @param array $params
+ * @return $this|CaptchaGenerator
+ */
+ public function config($params = [])
+ {
+ if (empty($params)) return $this;
+ $this->configs['src'] = isset($params['src']) ? $params['src'] : $this->configs['src'];
+ $this->configs['im_width'] = isset($params['im_width']) ? $params['im_width'] : $this->configs['im_width'];
+ $this->configs['im_height'] = isset($params['im_height']) ? $params['im_height'] : $this->configs['im_height'];
+ $this->configs['im_type'] = isset($params['im_type']) ? $params['im_type'] : $this->configs['im_type'];
+ $this->configs['quality'] = isset($params['quality']) ? $params['quality'] : $this->configs['quality'];
+ $this->configs['type'] = isset($params['type']) ? $params['type'] : $this->configs['type'];
+ $this->configs['font_family'] = isset($params['font_family']) ? $params['font_family'] : $this->configs['font_family'];
+ $this->configs['font_size'] = isset($params['font_size']) ? $params['font_size'] : $this->configs['font_size'];
+ $this->configs['font_count'] = isset($params['font_count']) ? $params['font_count'] : $this->configs['font_count'];
+ $this->configs['line_count'] = isset($params['line_count']) ? $params['line_count'] : $this->configs['line_count'];
+ $this->configs['char_count'] = isset($params['char_count']) ? $params['char_count'] : $this->configs['char_count'];
+ return $this;
+ }
+
+ public function check($key, $value, $leeway = 0, $secret = null)
+ {
+ $x = $this->getCache($key) ?: $secret;
+
+ if (empty($x)) return false;
+
+ return $x == $value;
+ }
+
+ public function get($expire = 0)
+ {
+ $data = $this->draw();
+
+ $this->imOutput(
+ $this->im,
+ $this->configs['im_type'],
+ $this->configs['quality'],
+ 'input'
+ );
+
+ $baseData = $this->baseData($this->im, $this->configs['im_type']);
+
+ $key = uniqid('input:' . $this->configs['type'] . mt_rand(0, 9999), true);
+
+ $res = [
+ 'key' => $key,
+ 'img' => $baseData,
+ ];
+
+ $setCache = $this->setCache($key, $data['value'], $expire);
+ if (!$setCache) $res['secret'] = $data['value'];
+
+ return $res;
+ }
+}
diff --git a/niucloud/vendor/kkokk/poster/src/Captcha/Generators/RotateGenerator.php b/niucloud/vendor/kkokk/poster/src/Captcha/Generators/RotateGenerator.php
new file mode 100644
index 000000000..d0eb4fbe8
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Captcha/Generators/RotateGenerator.php
@@ -0,0 +1,81 @@
+ '',
+ 'im_width' => 350,
+ 'im_height' => 350,
+ 'im_type' => 'png', // png 默认 jpg quality 质量
+ 'quality' => 80, // jpg quality 质量
+ ]; // 验证码图片配置
+
+ /**
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2023/3/29
+ * Time: 15:05
+ * @param array $params
+ * @return $this|CaptchaGenerator
+ */
+ public function config($params = [])
+ {
+ if (empty($params)) return $this;
+ $this->configs['src'] = isset($params['src']) ? $params['src'] : $this->configs['src'];
+ $this->configs['im_width'] = isset($params['im_width']) ? $params['im_width'] : $this->configs['im_width'];
+ $this->configs['im_height'] = isset($params['im_height']) ? $params['im_height'] : $this->configs['im_height'];
+ $this->configs['im_type'] = isset($params['im_type']) ? $params['im_type'] : $this->configs['im_type'];
+ $this->configs['quality'] = isset($params['quality']) ? $params['quality'] : $this->configs['quality'];
+ return $this;
+ }
+
+ public function check($key, $value, $leeway = 3, $secret = null)
+ {
+ $x = $this->getCache($key) ?: $secret;
+
+ if (empty($x)) return false;
+
+ $leeway = $leeway ?: $this->leeway;
+
+ return $x >= ($value - $leeway) && $x <= ($value + $leeway);
+ }
+
+ public function get($expire = 0)
+ {
+ $data = $this->draw();
+
+ $this->imOutput(
+ $this->im,
+ $this->configs['im_type'],
+ $this->configs['quality'],
+ 'rotate'
+ );
+
+ $baseData = $this->baseData($this->im, $this->configs['im_type']);
+
+ $key = uniqid('rotate' . mt_rand(0, 9999), true);
+
+ $res = [
+ 'img' => $baseData,
+ 'key' => $key,
+ ];
+
+ $setCache = $this->setCache($key, $data['angle'], $expire);
+ if (!$setCache) $res['secret'] = $data['angle'];
+
+ return $res;
+ }
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/Captcha/Generators/SliderGenerator.php b/niucloud/vendor/kkokk/poster/src/Captcha/Generators/SliderGenerator.php
new file mode 100644
index 000000000..e963f0ba6
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Captcha/Generators/SliderGenerator.php
@@ -0,0 +1,111 @@
+ '',
+ 'im_width' => 340,
+ 'im_height' => 251,
+ 'im_type' => 'png', // png 默认 jpg quality 质量
+ 'quality' => 80, // jpg quality 质量
+ 'type' => '4', // 默认四边形 3 三角形 5 五边形 6 六边形
+ 'bg_width' => 340,
+ 'bg_height' => 191,
+ 'slider_width' => 50,
+ 'slider_height' => 50,
+ 'slider_border' => 2,
+ 'slider_bg' => 1,
+ ]; // 验证码图片配置
+
+ /**
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2023/3/29
+ * Time: 15:06
+ * @param array $params
+ * @return $this|CaptchaGenerator
+ */
+ public function config($params = [])
+ {
+ if (empty($params)) return $this;
+ $this->configs['src'] = isset($params['src']) ? $params['src'] : $this->configs['src'];
+ $this->configs['im_width'] = isset($params['im_width']) ? $params['im_width'] : $this->configs['im_width'];
+ $this->configs['im_height'] = isset($params['im_height']) ? $params['im_height'] : $this->configs['im_height'];
+ $this->configs['im_type'] = isset($params['im_type']) ? $params['im_type'] : $this->configs['im_type'];
+ $this->configs['quality'] = isset($params['quality']) ? $params['quality'] : $this->configs['quality'];
+ $this->configs['bg_width'] = isset($params['bg_width']) ? $params['bg_width'] : $this->configs['bg_width'];
+ $this->configs['bg_height'] = isset($params['bg_height']) ? $params['bg_height'] : $this->configs['bg_height'];
+ $this->configs['slider_width'] = isset($params['slider_width']) ? $params['slider_width'] : $this->configs['slider_width'];
+ $this->configs['slider_height'] = isset($params['slider_height']) ? $params['slider_height'] : $this->configs['slider_height'];
+ $this->configs['slider_border'] = isset($params['slider_border']) ? $params['slider_border'] : $this->configs['slider_border'];
+ $this->configs['slider_bg'] = isset($params['slider_bg']) ? $params['slider_bg'] : $this->configs['slider_bg'];
+ $this->configs['type'] = isset($params['type']) ? $params['type'] : $this->configs['type'];
+
+ return $this;
+ }
+
+ public function get($expire = 0)
+ {
+
+ $data = $this->draw();
+
+ $this->imOutput(
+ $this->im,
+ $this->configs['im_type'],
+ $this->configs['quality'],
+ 'slider'
+ );
+
+ $baseData = $this->baseData($this->im, $this->configs['im_type']);
+
+ $key = uniqid('slider' . mt_rand(0, 9999), true);
+
+ $res = [
+ 'img' => $baseData,
+ 'key' => $key,
+ 'y' => $data['y'],
+ ];
+
+ $setCache = $this->setCache($key, $data['x'], $expire);
+ if (!$setCache) $res['secret'] = $data['x'];
+
+ return $res;
+ }
+
+ /**
+ * 判断是否正确
+ * 目前使用的是 laravel 的 cache
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2022/12/7
+ * Time: 11:44
+ * @param $key
+ * @param $value
+ * @param int $leeway
+ * @return bool
+ */
+ public function check($key, $value, $leeway = 0, $secret = null)
+ {
+ $x = $this->getCache($key) ?: $secret;
+
+ if (empty($x)) return false;
+
+ $leeway = $leeway ?: $this->leeway;
+
+ return $x >= ($value - $leeway) && $x <= ($value + $leeway);
+ }
+
+}
diff --git a/niucloud/vendor/kkokk/poster/src/Captcha/Traits/ClickTrait.php b/niucloud/vendor/kkokk/poster/src/Captcha/Traits/ClickTrait.php
new file mode 100644
index 000000000..c6b1c58fa
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Captcha/Traits/ClickTrait.php
@@ -0,0 +1,196 @@
+configs['im_width'];
+ $im_height = $this->configs['im_height'];
+ $bg_width = $this->configs['bg_width'];
+ $bg_height = $this->configs['bg_height'];
+
+ $this->im = $this->PosterDriver->createIm($bg_width, $bg_height, [], true);
+ $bg = $this->PosterDriver->createIm($im_width, $im_height, [], true);
+
+ $this->drawImage($this->configs['src'], true);
+
+ imagecopy($bg, $this->im, 0, 0, 0, 0, $bg_width, $bg_height);
+
+ $this->im = $bg;
+
+ $this->drawLine($bg_width, $bg_height); // 干扰线
+
+ $this->drawChar($bg_width, $bg_height); // 干扰字符
+
+ $data = $this->drawText(); // 字
+
+ return $data;
+ }
+
+ // 计算 三个点的叉乘 |p1 p2| X |p1 p|
+ public function getCross($p1, $p2, $p)
+ {
+ // (p2.x - p1.x) * (p.y - p1.y) -(p.x - p1.x) * (p2.y - p1.y);
+ return ($p1[0] - $p[0]) * ($p2[1] - $p[1]) - ($p2[0] - $p[0]) * ($p1[1] - $p[1]);
+ }
+
+ public function getContents($contentsLen)
+ {
+
+ $contents = [];
+
+ if ($this->configs['contents']) {
+
+ for ($i = 0; $i < $contentsLen; $i++) {
+ $contents[$i]['contents'] = mb_substr($this->configs['contents'], $i, 1);
+ }
+
+ } else {
+
+ $str = $this->getChar('text');
+
+ for ($i = 0; $i < $contentsLen; $i++) {
+ $contents[$i]['contents'] = mb_substr($str, mt_rand(0, 299), 1);
+ }
+
+ }
+
+ return $contents;
+ }
+
+ public function getSpace($contentsLen)
+ {
+
+ $font = $this->configs['font_size'] + 15;
+ $bg_width = $this->configs['bg_width'];
+ $bg_height = $this->configs['bg_width'];
+
+ switch ($contentsLen) {
+ case 2:
+ $space[] = [
+ mt_rand($font, $bg_width / 2 - $font),
+ mt_rand($font, $bg_height - $font / 2 - 12),
+ ];
+ $space[] = [
+ mt_rand($bg_width / 2, $bg_width - $font),
+ mt_rand($font, $bg_height - $font / 2 - 12),
+ ];
+ break;
+ case 3:
+ $space[] = [
+ mt_rand($font, $bg_width / 2 - $font),
+ mt_rand($font, $bg_height / 2),
+ ];
+ $space[] = [
+ mt_rand($bg_width / 2, $bg_width - $font),
+ mt_rand($font, $bg_height / 2),
+ ];
+ $space[] = [
+ mt_rand($font, $bg_width - $font),
+ mt_rand($bg_height / 2 + $font, $bg_height - $font / 2 - 12),
+ ];
+ break;
+ default:
+ $space[] = [
+ mt_rand($font, $bg_width / 2 - $font),
+ mt_rand($font, $bg_height / 2),
+ ];
+ $space[] = [
+ mt_rand($bg_width / 2, $bg_width - $font),
+ mt_rand($font, $bg_height / 2),
+ ];
+ $space[] = [
+ mt_rand($font, $bg_width / 2 - $font),
+ mt_rand($bg_height / 2 + $font, $bg_height - $font / 2 - 12),
+ ];
+ $space[] = [
+ mt_rand($bg_width / 2, $bg_width - $font),
+ mt_rand($bg_height / 2 + $font, $bg_height - $font / 2 - 12),
+ ];
+ break;
+ }
+
+ return $space;
+ }
+
+ public function drawText()
+ {
+ $font_family = $this->configs['font_family'];
+ $font = $this->configs['font_size'];
+
+ $contentsLen = $this->configs['font_count'] ?: mt_rand(2, 4);
+ $contentsLen = $contentsLen < 2 ? 2 : ($contentsLen > 4 ? 4 : $contentsLen);
+
+ $contents = $this->getContents($contentsLen);
+
+ $color = $this->PosterDriver->createColorAlpha($this->im, [255, 255, 255, 1]);
+
+ $spaces = $this->getSpace($contentsLen);
+
+ $content = "";
+
+ foreach ($contents as $k => $v) {
+ $content .= $v['contents'];
+ // 随机获取位置
+ $spaceKey = mt_rand(0, count($spaces) - 1);
+ $space = array_splice($spaces, $spaceKey, 1);
+ $angle = mt_rand(-80, 80); // 旋转角度
+ $fontBox = imagettfbbox($font, $angle, $font_family, $v['contents']); // 计算文字方框坐标
+ $x = $space[0][0]; // 起始x坐标
+ $y = $space[0][1]; // 起始y坐标
+ $contents[$k]['point'] = [
+ $x + $fontBox[0], // 左下角,X 位置
+ $y + $fontBox[1], // 左下角,Y 位置
+ $x + $fontBox[2], // 右下角,X 位置
+ $y + $fontBox[3], // 右下角,Y 位置
+ $x + $fontBox[4], // 右上角,X 位置
+ $y + $fontBox[5], // 右上角,Y 位置
+ $x + $fontBox[6], // 左上角,X 位置
+ $y + $fontBox[7], // 左上角,Y 位置
+ $angle, // 旋转角度
+ ];
+ imagettftext($this->im, $font, $angle, $x, $y, $color, $font_family, $v['contents']);
+ // 加粗字体
+ $ttfCount = 6;
+ for ($j = 1; $j <= $ttfCount; $j++) {
+ // 随机颜色
+ $ttfColor = $this->PosterDriver->createColorAlpha($this->im, [mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255), 1]);
+ imagettftext($this->im, $font - ($j * 2), $angle, $x + $j, $y - $j, $ttfColor, $font_family, $v['contents']);
+ }
+ }
+
+ // 显示字体为黑色
+ $color = $this->PosterDriver->createColorAlpha($this->im, [0, 0, 0, 1]);
+
+ $viewFont = 22; // 显示字体大小
+ $fontBox = imagettfbbox($viewFont, 0, $font_family, $content); // 计算文字长宽
+ $viewHeight = 296; // 显示字体y坐标
+ imagettftext($this->im, $viewFont, 0, 10, $viewHeight, $color, $font_family, $content);
+
+ $content_height = abs($fontBox[7]) + 1;
+ return [
+ 'content' => $content,
+ 'content_width' => $fontBox[2],
+ 'content_height' => $content_height,
+ 'x' => 10,
+ 'y' => $viewHeight - $content_height,
+ 'contents' => $contents,
+ ];
+
+ }
+
+ protected function getImBg()
+ {
+ return __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'style' . DIRECTORY_SEPARATOR . 'rotate_bg' . DIRECTORY_SEPARATOR . 'rotate0' . mt_rand(1, 5) . '.jpg';
+ }
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/Captcha/Traits/InputTrait.php b/niucloud/vendor/kkokk/poster/src/Captcha/Traits/InputTrait.php
new file mode 100644
index 000000000..5783565d9
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Captcha/Traits/InputTrait.php
@@ -0,0 +1,133 @@
+configs['im_width'];
+ $im_height = $this->configs['im_height'];
+
+ $this->im = $this->PosterDriver->createIm($im_width, $im_height, [mt_rand(125, 255), 255, mt_rand(125, 255), 1], false);
+
+ if ($this->configs['src']) { // 如果指定背景则用背景
+ $this->drawImage($this->configs['src'], false, 0, 0, 0, 0, $im_width, $im_height);
+ }
+
+ $this->drawLine(); // 干扰线
+
+ $this->drawChar(); // 干扰字
+
+ $res = $this->getContents();
+
+ $this->drawText($res['contents']); // 字
+
+ return $res;
+ }
+
+ public function getContents()
+ {
+ // type = number 数字 alpha_num 字母和数字 math 计算 text 文字
+ $fontCount = $this->configs['font_count'];
+ $contents = '';
+ switch ($this->configs['type']) {
+ case 'math':
+ $formula = '+-x';
+ $a = mt_rand(0, 20);
+ $b = mt_rand(0, 20);
+
+ $formula = substr($formula, mt_rand(0, 2), 1);
+
+ if ($formula == '+') $mul = $a + $b;
+ if ($formula == '-') $mul = $a - $b;
+ if ($formula == 'x') $mul = $a * $b;
+
+ $res = [
+ 'contents' => [
+ $a,
+ $formula,
+ $b,
+ '='
+ ],
+ 'value' => $mul,
+ ];
+
+ break;
+ case 'text':
+ $str = $this->getChar($this->configs['type']);
+ for ($i = 0; $i < $fontCount; $i++) {
+ $contents .= mb_substr($str, mt_rand(0, 499), 1);
+ }
+ $res = [
+ 'contents' => $contents,
+ 'value' => $contents,
+ ];
+ break;
+ case 'alpha_num':
+ $str = $this->getChar($this->configs['type']);
+ for ($i = 0; $i < $fontCount; $i++) {
+ $contents .= substr($str, mt_rand(0, 61), 1);
+ }
+ $res = [
+ 'contents' => $contents,
+ 'value' => $contents,
+ ];
+ break;
+ default:
+ $str = $this->getChar($this->configs['type']);
+ for ($i = 0; $i < $fontCount; $i++) {
+ $contents .= substr($str, mt_rand(0, 9), 1);
+ }
+ $res = [
+ 'contents' => $contents,
+ 'value' => $contents,
+ ];
+ break;
+ }
+
+ return $res;
+ }
+
+ public function drawText($contents)
+ {
+ $font_family = $this->configs['font_family'];
+ $font = $this->configs['font_size'];
+ $im_width = $this->configs['im_width'];
+ $im_height = $this->configs['im_height'];
+
+ if (is_array($contents)) {
+ $equally = $im_width / count($contents);
+ foreach ($contents as $k => $v) {
+ $color = $this->PosterDriver->createColorAlpha($this->im, [mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255), 1]);
+ $content = $v;
+ $x = mt_rand($k * $equally + 10, ($k + 1) * $equally - $font);
+ $y = mt_rand($font + 10, $im_height);
+ $angle = $this->configs['type'] === 'math' ? 0 : mt_rand(0, 45);
+ imagettftext($this->im, $font, $angle, $x, $y, $color, $font_family, $content);
+ }
+
+ } else {
+ $equally = $im_width / mb_strlen($contents);
+
+ for ($i = 0; $i < mb_strlen($contents); $i++) {
+ $color = $this->PosterDriver->createColorAlpha($this->im, [mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255), 1]);
+ $content = mb_substr($contents, $i, 1);
+ $x = mt_rand($i * $equally + 10, ($i + 1) * $equally - $font);
+ $y = mt_rand($font + 10, $im_height);
+ $angle = mt_rand(0, 45);
+ imagettftext($this->im, $font, $angle, $x, $y, $color, $font_family, $content);
+ }
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/Captcha/Traits/RotateTrait.php b/niucloud/vendor/kkokk/poster/src/Captcha/Traits/RotateTrait.php
new file mode 100644
index 000000000..6992f720c
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Captcha/Traits/RotateTrait.php
@@ -0,0 +1,70 @@
+configs['im_width'];
+ $im_height = $this->configs['im_height'];
+
+ $this->im = $this->PosterDriver->createIm($im_width, $im_height, [], true);
+
+ $this->drawImage($this->configs['src'], true); // 背景图
+
+ // 旋转角度
+ $angle = mt_rand(45, 315);
+
+ $this->im = imagerotate($this->im, $angle, 0);
+
+ $this->drawRotate();
+
+ return [
+ 'angle' => $angle
+ ];
+ }
+
+ protected function drawRotate()
+ {
+ $Width = imagesx($this->im);
+
+ $rotateBg = $this->im; // 旋转后的背景
+
+ $bgWidth = $this->configs['im_width'];
+ $bgHeight = $this->configs['im_height'];
+
+ $circle = $this->PosterDriver->createIm($bgWidth, $bgHeight, [255, 255, 255, 127], $alpha = false);
+
+ $this->im = $this->PosterDriver->createIm($bgWidth, $bgHeight, [255, 255, 255, 127], $alpha = true); // 最后输出的jpg
+
+ $surplusR = ($Width - $bgWidth) / 2;
+
+ $r = ($bgWidth / 2) - 2; //圆半径
+ for ($x = 0; $x < $bgWidth; $x++) {
+ for ($y = 0; $y < $bgHeight; $y++) {
+ if (((($x - $r) * ($x - $r) + ($y - $r) * ($y - $r)) < ($r * $r))) {
+ $rgbColor = imagecolorat($rotateBg, $x + 2 + $surplusR, $y + 2 + $surplusR);
+ imagesetpixel($circle, $x + 2, $y + 2, $rgbColor);
+ }
+ }
+ }
+ imagecopyresampled($this->im, $circle, 0, 0, 2, 2, $bgWidth, $bgHeight, $bgWidth - 3, $bgHeight - 3);
+
+ $this->destroyImage($rotateBg);
+ $this->destroyImage($circle);
+ }
+
+ protected function getImBg()
+ {
+ return __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'style' . DIRECTORY_SEPARATOR . 'rotate_bg' . DIRECTORY_SEPARATOR . 'rotate0' . mt_rand(1, 5) . '.jpg';
+ }
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/Captcha/Traits/SliderTrait.php b/niucloud/vendor/kkokk/poster/src/Captcha/Traits/SliderTrait.php
new file mode 100644
index 000000000..7dde6dda0
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Captcha/Traits/SliderTrait.php
@@ -0,0 +1,451 @@
+configs['type'];
+ return $this->$func();
+ }
+
+ // 实现图片绘制
+ public function draw3()
+ {
+
+ $im_width = $this->configs['im_width'];
+ $im_height = $this->configs['im_height'];
+
+ $this->im = $this->PosterDriver->createIm($im_width, $im_height, [], true);
+
+ $this->drawImage($this->configs['src']); // 添加bg图片
+
+ $bg_width = $this->configs['bg_width'];
+ $bg_height = $this->configs['bg_height'];
+
+ $slider_width = $this->configs['slider_width'];
+ $slider_height = $this->configs['slider_height'];
+ $border = $this->configs['slider_border'];
+
+ $w = $slider_width;
+ $h = $slider_height;
+
+ $bgColor = $this->PosterDriver->createColorAlpha($this->im, [0, 0, 0, 60]);
+
+ $ims = $this->PosterDriver->createIm($slider_width, $slider_height, [], true); // 创建抠图背景
+
+ $x1 = mt_rand($slider_width * 2, $bg_width - $w - 10);
+ $x2 = $x1 + $w;
+
+ $y1 = mt_rand(0, $bg_height - $h);
+ $y2 = $y1 + $h;
+
+ $halfBorder = $border / 2;
+
+ $borderColor = $this->PosterDriver->createColor($this->im, [255, 255, 255, 1]);
+
+ $points = [
+ $x1 + $w / 2, $y1,
+ $x2, $y2,
+ $x1, $y2,
+ ];
+
+ // 三角形
+ $p1 = [$points[0], $points[1]];
+ $p2 = [$points[2], $points[3]];
+ $p3 = [$points[4], $points[5]];
+
+ for ($i = 0; $i < $bg_width; $i++) {
+ for ($j = 0; $j < $bg_height; $j++) {
+ // 利用叉积抠图 p1 p2 p3 可以抠多边形
+ // 任意坐标点
+ $p = [$i, $j];
+
+ $cross1 = $this->getCross($p1, $p2, $p);
+ $cross2 = $this->getCross($p2, $p3, $p);
+ $cross3 = $this->getCross($p3, $p1, $p);
+
+ $isCross = $cross1 > 0 && $cross2 > 0 && $cross3 > 0;
+
+ if ($isCross) {
+ $rgbColor = imagecolorat($this->im, $i, $j);
+ imagesetpixel($ims, $i - $x1, $j - $y1, $rgbColor); // 抠图
+ }
+ // $isCross1 = $cross1 * $cross2 * $cross3 == 0;
+ // if($isCross1) {
+ // imagesetpixel($ims, $i - $x1, $j - $y1, $rgbColor); // 边框
+ // }
+ }
+ }
+
+ $this->drawImageFilledPolygon($this->im, $points, count($points) / 2, $bgColor);
+
+ $borderPoints = [
+ $w / 2, 0,
+ $w, $h - $halfBorder / 2,
+ 0, $h - $halfBorder / 2,
+ ];
+ imagesetthickness($ims, $halfBorder); // 划线的线宽加粗
+ imagepolygon($ims, $borderPoints, count($borderPoints) / 2, $borderColor);
+
+ $bgCount = 1;
+ $maxCount = min($this->configs['slider_bg'], 4);
+ $maxCount = max($maxCount, 1);
+ while ($bgCount < $maxCount) {
+ // 额外滑块背景
+ $x = mt_rand($slider_width * 2, $bg_width - $w);
+ $y = mt_rand(0, $bg_height - $h);
+ $points = [
+ $x + $w / 2, $y,
+ $x + $w, $y + $h,
+ $x, $y + $h,
+ ];
+ $this->drawImageFilledPolygon($this->im, $points, count($points) / 2, $bgColor);
+ $bgCount++;
+ }
+
+ imagecopy($this->im, $ims, 5, 196, 0, 0, imagesx($ims), imagesy($ims));
+
+ $this->destroyImage($ims);
+ return [
+ 'x' => $x1,
+ 'y' => $y1,
+ ];
+ }
+
+ public function draw4()
+ {
+
+ $im_width = $this->configs['im_width'];
+ $im_height = $this->configs['im_height'];
+
+ $this->im = $this->PosterDriver->createIm($im_width, $im_height, [], true);
+
+ $this->drawImage($this->configs['src']); // 添加bg图片
+
+ $bg_width = $this->configs['bg_width'];
+ $bg_height = $this->configs['bg_height'];
+
+ $slider_width = $this->configs['slider_width'];
+ $slider_height = $this->configs['slider_height'];
+ $border = $this->configs['slider_border'];
+
+ $w = $slider_width - $border;
+ $h = $slider_height - $border;
+
+ $bgColor = $this->PosterDriver->createColorAlpha($this->im, [0, 0, 0, 60]);
+
+ $ims = $this->PosterDriver->createIm($slider_width, $slider_height, [], false); // 创建抠图背景
+
+ $x1 = mt_rand($slider_width * 2, $bg_width - $w - 10);
+ $x2 = $x1 + $w;
+
+ $y1 = mt_rand(0, $bg_height - $h);
+ $y2 = $y1 + $h;
+
+ $halfBorder = $border / 2;
+
+ // 矩形
+ $p1 = [$x1 + $halfBorder - 1, $y2 + $halfBorder]; // 左下
+ $p2 = [$x2 + $halfBorder, $y2 + $halfBorder]; // 右下
+ $p3 = [$x2 + $halfBorder, $y1 + $halfBorder - 1]; // 右上
+ $p4 = [$x1 + $halfBorder - 1, $y1 + $halfBorder - 1]; // 左上
+
+ for ($i = 0; $i < $bg_width; $i++) {
+ for ($j = 0; $j < $bg_height; $j++) {
+ // 矩形抠图
+ // if (($i < $x2 && $i >= $x1) && ($j < $y2 && $j >= $y1)) {
+ // $rgbColor = imagecolorat($this->im, $i, $j);
+ // imagesetpixel($ims, $i - $x1 + $border / 2, $j - $y1 + $border / 2, $rgbColor); // 抠图
+ // }
+
+
+ // 利用叉积抠图 p1 p2 p3 可以抠多边形
+ // 任意坐标点
+ $p = [$i, $j];
+
+ // 叉积计算 点在四条平行线内部则是在矩形内 p1->p2 p1->p3 参考点 p1 叉积大于0点p3在p2逆时针方向 等于0 三点一线 小于0 点p3在p2顺时针防线
+ $isCross = $this->getCross($p1, $p2, $p) * $this->getCross($p3, $p4, $p) > 0 && $this->getCross($p2, $p3, $p) * $this->getCross($p4, $p1, $p) > 0;
+ if ($isCross) {
+ $rgbColor = imagecolorat($this->im, $i, $j);
+ imagesetpixel($ims, $i - $x1, $j - $y1, $rgbColor); // 抠图
+ }
+ }
+ }
+
+ imagefilledrectangle($this->im, $x1, $y1, $x1 + $slider_width, $y1 + $slider_height, $bgColor);
+
+ $bgCount = 1;
+ $maxCount = min($this->configs['slider_bg'], 4);
+ $maxCount = max($maxCount, 1);
+ while ($bgCount < $maxCount) {
+ // 额外滑块背景
+ $x = mt_rand(30, $bg_width - $w);
+ $y = mt_rand(0, $bg_height - $h);
+ imagefilledrectangle($this->im, $x, $y, $x + $slider_width, $y + $slider_height, $bgColor);
+ $bgCount++;
+ }
+
+ imagecopy($this->im, $ims, 5, 196, 0, 0, $slider_width, $slider_width);
+
+ $this->destroyImage($ims);
+
+ return [
+ 'x' => $x1,
+ 'y' => $y1,
+ ];
+ }
+
+ public function draw5()
+ {
+
+ $im_width = $this->configs['im_width'];
+ $im_height = $this->configs['im_height'];
+
+ $this->im = $this->PosterDriver->createIm($im_width, $im_height, [], true);
+
+ $this->drawImage($this->configs['src']); // 添加bg图片
+
+ $bg_width = $this->configs['bg_width'];
+ $bg_height = $this->configs['bg_height'];
+
+ $slider_width = $this->configs['slider_width'];
+ $slider_height = $this->configs['slider_height'];
+ $border = $this->configs['slider_border'];
+
+ $w = $slider_width;
+ $h = $slider_height;
+
+ $bgColor = $this->PosterDriver->createColorAlpha($this->im, [0, 0, 0, 60]);
+
+ $ims = $this->PosterDriver->createIm($slider_width, $slider_height, [], true); // 创建抠图背景
+
+ $x1 = mt_rand($slider_width * 2, $bg_width - $w - 10);
+ $x2 = $x1 + $w;
+
+ $y1 = mt_rand(0, $bg_height - $h);
+ $y2 = $y1 + $h;
+
+ $halfBorder = $border / 2;
+
+ $borderColor = $this->PosterDriver->createColor($this->im, [255, 255, 255, 1]);
+
+ $points = [
+ $x1 + $w / 2, $y1,
+ $x2, $y1 + $h / 2,
+ $x1 + $w * 3 / 4, $y2,
+ $x1 + $w / 4, $y2,
+ $x1, $y1 + $h / 2,
+ ];
+
+ // 五边形
+ $p1 = [$points[0], $points[1]];
+ $p2 = [$points[2], $points[3]];
+ $p3 = [$points[4], $points[5]];
+ $p4 = [$points[6], $points[7]];
+ $p5 = [$points[8], $points[9]];
+
+ for ($i = 0; $i < $bg_width; $i++) {
+ for ($j = 0; $j < $bg_height; $j++) {
+ // 利用叉积抠图 p1 p2 p3 可以抠多边形
+ // 任意坐标点
+ $p = [$i, $j];
+
+ $cross1 = $this->getCross($p1, $p2, $p);
+ $cross2 = $this->getCross($p2, $p3, $p);
+ $cross3 = $this->getCross($p3, $p4, $p);
+ $cross4 = $this->getCross($p4, $p5, $p);
+ $cross5 = $this->getCross($p5, $p1, $p);
+
+ $isCross = $cross1 > 0 && $cross2 > 0 && $cross3 > 0 && $cross4 > 0 && $cross5 > 0;
+
+ if ($isCross) {
+ $rgbColor = imagecolorat($this->im, $i, $j);
+ imagesetpixel($ims, $i - $x1, $j - $y1, $rgbColor); // 抠图
+ }
+ }
+ }
+
+ $this->drawImageFilledPolygon($this->im, $points, count($points) / 2, $bgColor);
+
+ $borderPoints = [
+ $w / 2, 0,
+ $w, $h / 2,
+ $w * 3 / 4, $h - $halfBorder / 2,
+ $w * 1 / 4, $h - $halfBorder / 2,
+ 0, $h / 2,
+ ];
+ imagesetthickness($ims, $halfBorder); // 划线的线宽加粗
+ imagepolygon($ims, $borderPoints, count($borderPoints) / 2, $borderColor);
+
+ $bgCount = 1;
+ $maxCount = min($this->configs['slider_bg'], 4);
+ $maxCount = max($maxCount, 1);
+ while ($bgCount < $maxCount) {
+ // 额外滑块背景
+ $x = mt_rand($slider_width * 2, $bg_width - $w);
+ $y = mt_rand(0, $bg_height - $h);
+ $points = [
+ $x + $w / 2, $y,
+ $x + $w, $y + $h / 2,
+ $x + $w * 3 / 4, $y + $h,
+ $x + $w / 4, $y + $h,
+ $x, $y + $h / 2,
+ ];
+ $this->drawImageFilledPolygon($this->im, $points, count($points) / 2, $bgColor);
+ $bgCount++;
+ }
+
+ imagecopy($this->im, $ims, 5, 196, 0, 0, imagesx($ims), imagesy($ims));
+
+ $this->destroyImage($ims);
+ return [
+ 'x' => $x1,
+ 'y' => $y1,
+ ];
+ }
+
+ public function draw6()
+ {
+
+ $im_width = $this->configs['im_width'];
+ $im_height = $this->configs['im_height'];
+
+ $this->im = $this->PosterDriver->createIm($im_width, $im_height, [], true);
+
+ $this->drawImage($this->configs['src']); // 添加bg图片
+
+ $bg_width = $this->configs['bg_width'];
+ $bg_height = $this->configs['bg_height'];
+
+ $slider_width = $this->configs['slider_width'];
+ $slider_height = $this->configs['slider_height'];
+ $border = $this->configs['slider_border'];
+
+ $w = $slider_width;
+ $h = $slider_height;
+
+ $bgColor = $this->PosterDriver->createColorAlpha($this->im, [0, 0, 0, 60]);
+
+ $ims = $this->PosterDriver->createIm($slider_width, $slider_height, [], true); // 创建抠图背景
+
+ $x1 = mt_rand($slider_width * 2, $bg_width - $w - 10);
+ $x2 = $x1 + $w;
+
+ $y1 = mt_rand(0, $bg_height - $h);
+ $y2 = $y1 + $h;
+
+ $halfBorder = $border / 2;
+
+ $borderColor = $this->PosterDriver->createColor($this->im, [255, 255, 255, 1]);
+
+ $points = [
+ $x1 + $w / 4, $y1,
+ $x1 + $w * 3 / 4, $y1,
+ $x2, $y1 + $h / 2,
+ $x1 + $w * 3 / 4, $y2,
+ $x1 + $w / 4, $y2,
+ $x1, $y1 + $h / 2,
+ ];
+
+ // 五边形
+ $p1 = [$points[0], $points[1]];
+ $p2 = [$points[2], $points[3]];
+ $p3 = [$points[4], $points[5]];
+ $p4 = [$points[6], $points[7]];
+ $p5 = [$points[8], $points[9]];
+ $p6 = [$points[10], $points[11]];
+
+ for ($i = 0; $i < $bg_width; $i++) {
+ for ($j = 0; $j < $bg_height; $j++) {
+ // 利用叉积抠图 p1 p2 p3 可以抠多边形
+ // 任意坐标点
+ $p = [$i, $j];
+
+ $cross1 = $this->getCross($p1, $p2, $p);
+ $cross2 = $this->getCross($p2, $p3, $p);
+ $cross3 = $this->getCross($p3, $p4, $p);
+ $cross4 = $this->getCross($p4, $p5, $p);
+ $cross5 = $this->getCross($p5, $p6, $p);
+ $cross6 = $this->getCross($p6, $p1, $p);
+
+ $isCross = $cross1 > 0 && $cross2 > 0 && $cross3 > 0 && $cross4 > 0 && $cross5 > 0 && $cross6 > 0;
+
+ if ($isCross) {
+ $rgbColor = imagecolorat($this->im, $i, $j);
+ imagesetpixel($ims, $i - $x1, $j - $y1, $rgbColor); // 抠图
+ }
+ }
+ }
+
+ $this->drawImageFilledPolygon($this->im, $points, count($points) / 2, $bgColor);
+
+ $borderPoints = [
+ $w / 4, 0,
+ $w * 3 / 4, 0,
+ $w, $h / 2,
+ $w * 3 / 4, $h - $halfBorder / 2,
+ $w * 1 / 4, $h - $halfBorder / 2,
+ 0, $h / 2,
+ ];
+ imagesetthickness($ims, $halfBorder); // 划线的线宽加粗
+ imagepolygon($ims, $borderPoints, count($borderPoints) / 2, $borderColor);
+
+ $bgCount = 1;
+ $maxCount = min($this->configs['slider_bg'], 4);
+ $maxCount = max($maxCount, 1);
+ while ($bgCount < $maxCount) {
+ // 额外滑块背景
+ $x = mt_rand($slider_width * 2, $bg_width - $w);
+ $y = mt_rand(0, $bg_height - $h);
+ $points = [
+ $x + $w / 4, $y,
+ $x + $w * 3 / 4, $y,
+ $x + $w, $y + $h / 2,
+ $x + $w * 3 / 4, $y + $h,
+ $x + $w / 4, $y + $h,
+ $x, $y + $h / 2,
+ ];
+ $this->drawImageFilledPolygon($this->im, $points, count($points) / 2, $bgColor);
+ $bgCount++;
+ }
+
+ imagecopy($this->im, $ims, 5, 196, 0, 0, imagesx($ims), imagesy($ims));
+
+ $this->destroyImage($ims);
+ return [
+ 'x' => $x1,
+ 'y' => $y1,
+ ];
+ }
+
+ /**
+ * php 8.1 废弃参数 $points_count
+ * User: lang
+ * Date: 2023/7/17
+ * Time: 10:45
+ * @param $im
+ * @param $points
+ * @param $points_count
+ * @param $color
+ * @return void
+ */
+ protected function drawImageFilledPolygon($im, $points, $points_count, $color){
+ if(PHP_VERSION < 8.1)
+ imagefilledpolygon($im, $points, $points_count, $color);
+ else
+ imagefilledpolygon($im, $points, $color);
+ }
+
+ protected function getImBg()
+ {
+ return __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'style' . DIRECTORY_SEPARATOR . 'slider_bg' . DIRECTORY_SEPARATOR . 'layer0' . mt_rand(1, 3) . '.jpg';
+ }
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/Common/Common.php b/niucloud/vendor/kkokk/poster/src/Common/Common.php
new file mode 100644
index 000000000..c6d4f5f2b
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Common/Common.php
@@ -0,0 +1,117 @@
+ 'imagegif',
+ 'jpeg' => 'imagejpeg',
+ 'jpg' => 'imagejpeg',
+ 'png' => 'imagepng',
+ 'wbmp' => 'imagewbmp'
+ ];
+
+ // 转base64
+ public function baseData($image, $type = 'png')
+ {
+ $baseData = '';
+ if (is_resource($image) || is_object($image)) {
+ ob_start();
+ $this->imType[$type]($image);
+ $data = ob_get_contents();
+ ob_end_clean();
+ $baseData = 'data:image/' . $type . ';base64,' . base64_encode($data);
+ imagedestroy($image);
+ } elseif (is_string($image)) {
+ $baseData = 'data:image/' . $type . ';base64,' . base64_encode($image);
+ }
+ return $baseData;
+ }
+
+ /**
+ * 输出图片
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2022/12/15
+ * Time: 10:44
+ * @param $im
+ * @param string $dir
+ * @param string $type
+ * @param int $quality
+ */
+ public function imOutput($im, $dir = '', $type = 'png', $quality = 75)
+ {
+ if ($type == 'jpg' || $type == 'jpeg') {
+ $this->imType[$type]($im, $dir, $quality);
+ } else {
+ $this->imType[$type]($im, $dir);
+ }
+
+ return 1;
+ }
+
+ /**
+ * 计算 三个点的叉乘 |p1 p2| X |p1 p|
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2022/12/15
+ * Time: 10:44
+ * @param int $p1
+ * @param int $p2
+ * @param int $p
+ * @return int
+ */
+ public function getCross($p1, $p2, $p)
+ {
+ // (p2.x - p1.x) * (p.y - p1.y) -(p.x - p1.x) * (p2.y - p1.y);
+ return ($p1[0] - $p[0]) * ($p2[1] - $p[1]) - ($p2[0] - $p[0]) * ($p1[1] - $p[1]);
+ }
+
+ public function getNodeStyleColor($color)
+ {
+ if(strpos($color, 'rgb') !== false) {
+ return $this->styleToRgba($color);
+ } elseif(strpos($color, '#') !== false) {
+ return $this->hexToRgba($color);
+ } else {
+ throw new PosterException('only support rgb or hexadecimal');
+ }
+ }
+
+ public function hexToRgba($hexColor)
+ {
+ $rgb = [];
+ $color = str_replace('#', '', $hexColor);
+ if (strlen($color) > 3) {
+ $rgb = [
+ hexdec(substr($color, 0, 2)),
+ hexdec(substr($color, 2, 2)),
+ hexdec(substr($color, 4, 2)),
+ 1,
+ ];
+ }
+
+ return $rgb;
+ }
+
+ public function styleRgbToRgba($rgbColor)
+ {
+ preg_match('/rgb\((.*?)\)/', $rgbColor, $color);
+ print_r($color);exit;
+ }
+
+ public function styleRgbaToRgba($rgbaColor)
+ {
+ preg_match('/rgba\((.*?)\)/', $rgbaColor, $color);
+ print_r($color);exit;
+ }
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/Exception/Exception.php b/niucloud/vendor/kkokk/poster/src/Exception/Exception.php
new file mode 100644
index 000000000..79a1fde56
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Exception/Exception.php
@@ -0,0 +1,33 @@
+ \Kkokk\Poster\Cache\Repository::class,
+ 'poster' => \Kkokk\Poster\Image\PosterManager::class,
+ 'captcha' => \Kkokk\Poster\Lang\Captcha::class,
+ 'html' => \Kkokk\Poster\Html\HtmlManager::class,
+ ];
+
+ protected static function getInstance()
+ {
+ return static::setInstance(static::getFacadeModel());
+ }
+
+ /**
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2023/3/10
+ * Time: 14:14
+ * @return string
+ * @throws PosterException
+ */
+ protected static function getFacadeModel()
+ {
+ throw new PosterException('未获取到模型');
+ }
+
+ // 设置实例
+ protected static function setInstance($model)
+ {
+ if (is_object($model)) {
+ return $model;
+ }
+
+ if (!isset($resolvedInstance[$model])) {
+ // 单例
+ static::$resolvedInstance = new self::$store[$model];
+ }
+
+ return static::$resolvedInstance;
+ }
+
+ public static function __callStatic($method, $args)
+ {
+
+ $instance = static::getInstance();
+
+ if (!$instance) {
+ throw new PosterException('未找到相关实例与方法');
+ }
+
+ return $instance->$method(...$args);
+ }
+}
diff --git a/niucloud/vendor/kkokk/poster/src/Facades/Html.php b/niucloud/vendor/kkokk/poster/src/Facades/Html.php
new file mode 100644
index 000000000..a113f5b90
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Facades/Html.php
@@ -0,0 +1,28 @@
+channel = $channel;
+ $this->query = $query;
+ }
+
+ public function load($html)
+ {
+ $this->query->buildQuery('load', [$html]);
+ return $this;
+ }
+
+ public function transparent($transparent = true)
+ {
+ $this->query->buildQuery('transparent', [$transparent]);
+ return $this;
+ }
+
+ public function size($width = 0, $height = 0)
+ {
+ $this->query->buildQuery('size', [$width, $height]);
+ return $this;
+ }
+
+ public function crop($crop_w = 0, $crop_h = 0, $crop_x = 0, $crop_y = 0)
+ {
+ $this->query->buildQuery('crop', [$crop_w, $crop_h, $crop_x, $crop_y]);
+ return $this;
+ }
+
+ public function type($type = 'png')
+ {
+ $this->query->buildQuery('type', [$type]);
+ return $this;
+ }
+
+ public function command($command = '')
+ {
+ $this->query->buildQuery('command', [$command]);
+ return $this;
+ }
+
+ public function output($path, $type = '')
+ {
+ $this->query->buildQuery('output', [$path, $type]);
+ return $this;
+ }
+
+ public function quality($quality)
+ {
+ $this->query->buildQuery('quality', [$quality]);
+ return $this;
+ }
+
+ public function render()
+ {
+ return $this->channel->render($this->query->getQuery());
+ }
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/Html/Drivers/Driver.php b/niucloud/vendor/kkokk/poster/src/Html/Drivers/Driver.php
new file mode 100644
index 000000000..fe303870c
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Html/Drivers/Driver.php
@@ -0,0 +1,23 @@
+html = $html;
+ }
+
+ public function size($width = 0, $height = 0)
+ {
+ if ($width) {
+ $this->size .= "--width " . $width;
+ }
+ if ($height) {
+ $this->size .= " --height " . $height;
+ }
+ }
+
+ public function crop($crop_w = 0, $crop_h = 0, $crop_x = 0, $crop_y = 0)
+ {
+ if ($crop_w) {
+ $this->crop .= " --crop-w " . $crop_w;
+ }
+ if ($crop_h) {
+ $this->crop .= " --crop-h " . $crop_h;
+ }
+ if ($crop_x) {
+ $this->crop .= " --crop-x " . $crop_x;
+ }
+ if ($crop_y) {
+ $this->crop .= " --crop-y " . $crop_y;
+ }
+ }
+
+ public function quality($quality)
+ {
+ $quality = max($quality, 0);
+ $quality = min($quality, 100);
+ $this->quality = '--quality ' . $quality;
+ }
+
+ public function setType($type)
+ {
+ $this->type = strtolower($type);
+ if ($this->type == 'pdf') {
+ $this->driver = 'wkhtmltopdf';
+ }
+ }
+
+ public function output($path, $type = '')
+ {
+ $this->output = $path;
+ if ($type) {
+ $this->setType($type);
+ }
+ }
+
+ public function setTransparent($transparent = true)
+ {
+ $this->transparent = $transparent ? '--transparent' : '';
+ }
+
+ /**
+ * 设置原生命令
+ * User: lang
+ * Date: 2023/8/10
+ * Time: 16:35
+ * @param $command
+ * @return void
+ */
+ public function setCommand($command)
+ {
+ $this->command .= ' ' . $command;
+ }
+
+ private function tmp()
+ {
+ $this->output = dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . uniqid('html') . '.png';
+ $this->tmp = true;
+ }
+
+ public function render($query)
+ {
+ foreach ($query as $v) {
+ switch ($v['type']) {
+ case "load":
+ $this->load(...$v['params']);
+ break;
+ case "crop":
+ $this->crop(...$v['params']);
+ break;
+ case "quality":
+ $this->quality(...$v['params']);
+ break;
+ case "type":
+ $this->setType(...$v['params']);
+ break;
+ case "tmp":
+ $this->tmp();
+ break;
+ case "output":
+ $this->output(...$v['params']);
+ break;
+ case "size":
+ $this->size(...$v['params']);
+ break;
+ case "transparent":
+ $this->setTransparent(...$v['params']);
+ break;
+ case "command":
+ $this->setCommand(...$v['params']);
+ break;
+ }
+ }
+
+ $check = exec($this->driver . ' --version');
+ if (empty($check)) {
+ throw new PosterException('Please install ' . $this->driver);
+ }
+
+
+ if (preg_match('/<[^>]*>/', $this->html)) {
+ $this->tmpHtmlPath = dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . uniqid('html') . '.html';
+ file_put_contents($this->tmpHtmlPath, $this->html);
+ $this->html = $this->tmpHtmlPath;
+ }
+
+ if ($this->type == 'pdf') {
+
+ if (empty($this->output)) {
+ throw new PosterException('Save path cannot be empty');
+ }
+ $this->quality = '';
+
+ } else {
+ if (empty($this->output)) {
+ $this->tmp();
+ }
+ }
+
+ $command = sprintf("%s %s %s %s %s %s %s %s", $this->driver, $this->command, $this->transparent, $this->size,
+ $this->crop, $this->quality, $this->html, $this->output);
+
+ exec($command);
+
+ return $this;
+ }
+
+ public function getImageBlob()
+ {
+ return file_get_contents($this->output);
+ }
+
+ public function getFilePath()
+ {
+ return $this->output;
+ }
+
+ function __destruct()
+ {
+ $this->tmp && @unlink($this->output);
+ $this->tmpHtmlPath && @unlink($this->tmpHtmlPath);
+ }
+}
+
diff --git a/niucloud/vendor/kkokk/poster/src/Html/Html.php b/niucloud/vendor/kkokk/poster/src/Html/Html.php
new file mode 100644
index 000000000..9bf4776e0
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Html/Html.php
@@ -0,0 +1,52 @@
+driver = $driver;
+ }
+
+ public function query()
+ {
+ return new Builder(
+ $this,
+ $this->getQueryInstance()
+ );
+ }
+
+ public function load($html)
+ {
+ return $this->query()->load($html);
+ }
+
+ public function render($query)
+ {
+ return $this->run($query, function ($query) {
+ return $this->driver->render($query);
+ });
+ }
+
+ protected function run($query, \Closure $callback)
+ {
+ try {
+ $result = $callback($query);
+ } catch (\Exception $e) {
+ throw new PosterException($e->getMessage(), 0, $e);
+ }
+
+ return $result;
+ }
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/Html/HtmlFactory.php b/niucloud/vendor/kkokk/poster/src/Html/HtmlFactory.php
new file mode 100644
index 000000000..8c609e78f
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Html/HtmlFactory.php
@@ -0,0 +1,39 @@
+createInstance($name);
+ }
+
+ protected function createDriver($name)
+ {
+ switch ($name) {
+ case 'wk':
+ return new WkDriver();
+ }
+
+ throw new PosterException("Unsupported driver [{$name}].");
+ }
+
+ private function createInstance($name)
+ {
+ switch ($name) {
+ case 'wk':
+ return new WkHtml($this->createDriver($name));
+ }
+
+ throw new PosterException("Unsupported channel [{$name}].");
+ }
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/Html/HtmlInterface.php b/niucloud/vendor/kkokk/poster/src/Html/HtmlInterface.php
new file mode 100644
index 000000000..b4f359ddc
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Html/HtmlInterface.php
@@ -0,0 +1,14 @@
+factory = new HtmlFactory;
+ }
+
+ public function channel($name = null)
+ {
+ $name = $this->parseConnectionName($name);
+
+ if (!isset($this->channels[$name])) {
+ $this->channels[$name] = $this->configure($this->makeChannel($name));
+ }
+
+ return $this->channels[$name];
+ }
+
+ protected function configure(Html $Html)
+ {
+ return $Html;
+ }
+
+ protected function parseConnectionName($name)
+ {
+ if (empty($name)) return $this->supportedChannels()[0];
+ return $name;
+ }
+
+ protected function makeChannel($name)
+ {
+ return $this->factory->make($name);
+ }
+
+ /**
+ * 获取所有支持通道。
+ *
+ * @return array
+ */
+ public function supportedChannels()
+ {
+ return ['wk'];
+ }
+
+ /**
+ * @param string $method
+ * @param array $parameters
+ * @return mixed
+ */
+ public function __call($method, $parameters)
+ {
+ return $this->channel()->$method(...$parameters);
+ }
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/Html/Queries/Query.php b/niucloud/vendor/kkokk/poster/src/Html/Queries/Query.php
new file mode 100644
index 000000000..5a4f7750e
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Html/Queries/Query.php
@@ -0,0 +1,25 @@
+query[] = ['type' => $type, 'params' => $params];
+ }
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/Html/Queries/WkQuery.php b/niucloud/vendor/kkokk/poster/src/Html/Queries/WkQuery.php
new file mode 100644
index 000000000..9a6621337
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Html/Queries/WkQuery.php
@@ -0,0 +1,17 @@
+query;
+ }
+
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/Html/WkHtml.php b/niucloud/vendor/kkokk/poster/src/Html/WkHtml.php
new file mode 100644
index 000000000..19c2672fd
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Html/WkHtml.php
@@ -0,0 +1,18 @@
+extension = $extension;
+ $this->query = $query;
+ $this->path = $path;
+ $this->query->setPath($path);
+ }
+
+ public function config($params = [])
+ {
+ $this->configs = $params;
+ $this->query->setQuery('config', $this->configs);
+ return $this;
+ }
+
+ public function buildIm($w, $h, $rgba = [255, 255, 255, 1], $alpha = false)
+ {
+ $this->im = [$w, $h, $rgba, $alpha];
+ $this->query->setQuery('im', $this->im);
+ return $this;
+ }
+
+ public function buildImDst($src, $w = 0, $h = 0)
+ {
+ $this->im = [$src, $w, $h];
+ $this->query->setQuery('imDst', $this->im);
+ return $this;
+ }
+
+ public function buildBg($w, $h, $rgba = [], $alpha = false, $dst_x = 0, $dst_y = 0, $src_x = 0, $src_y = 0, \Closure $callback = null)
+ {
+ $query = [];
+ if ($callback) {
+ $that = clone $this;
+ $that->query->clearQuery(); // 清理 query
+ $callback($that);
+ $query = $that->query->getQuery(); // 获取闭包内生成的query
+ unset($that);
+ }
+
+ $bg = [$w, $h, $rgba, $alpha, $dst_x, $dst_y, $src_x, $src_y, $query];
+ $this->query->setQuery('bg', $bg);
+ return $this;
+ }
+
+ public function buildImage($src, $dst_x = 0, $dst_y = 0, $src_x = 0, $src_y = 0, $src_w = 0, $src_h = 0, $alpha = false, $type = 'normal')
+ {
+ $this->setImages($src, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h, $alpha, $type);
+ return $this;
+ }
+
+ public function buildImageMany($params = [])
+ {
+ foreach ($params as $value) {
+ $value['dst_x'] = isset($value['dst_x']) ? $value['dst_x'] : 0;
+ $value['dst_y'] = isset($value['dst_y']) ? $value['dst_y'] : 0;
+ $value['src_x'] = isset($value['src_x']) ? $value['src_x'] : 0;
+ $value['src_y'] = isset($value['src_y']) ? $value['src_y'] : 0;
+ $value['src_w'] = isset($value['src_w']) ? $value['src_w'] : 0;
+ $value['src_h'] = isset($value['src_h']) ? $value['src_h'] : 0;
+ $value['alpha'] = isset($value['alpha']) ?: false;
+ $value['type'] = isset($value['type']) ? $value['type'] : 'normal';
+ $this->setImages($value['src'], $value['dst_x'], $value['dst_y'], $value['src_x'], $value['src_y'], $value['src_w'], $value['src_h'], $value['alpha'], $value['type']);
+ }
+ return $this;
+ }
+
+ public function buildText($content, $dst_x = 0, $dst_y = 0, $fontSize = null, $rgba = null, $max_w = null, $font = null, $weight = null, $space = null, $angle = null)
+ {
+ $this->setTexts($content, $dst_x, $dst_y, $fontSize, $rgba, $max_w, $font, $weight, $space, $angle);
+ return $this;
+ }
+
+ public function buildTextMany($params = [])
+ {
+ foreach ($params as $value) {
+ $value['dst_x'] = isset($value['dst_x']) ? $value['dst_x'] : 0;
+ $value['dst_y'] = isset($value['dst_y']) ? $value['dst_y'] : 0;
+ $value['fontSize'] = isset($value['font']) ? $value['font'] : 0;
+ $value['rgba'] = isset($value['rgba']) ? $value['rgba'] : [];
+ $value['max_w'] = isset($value['max_w']) ? $value['max_w'] : 0;
+ $value['font'] = isset($value['font_family']) ? $value['font_family'] : '';
+ $value['weight'] = isset($value['weight']) ? $value['weight'] : 1;
+ $value['space'] = isset($value['space']) ? $value['space'] : 0;
+ $value['angle'] = isset($value['angle']) ? $value['angle'] : 0;
+ $this->setTexts($value['content'], $value['dst_x'], $value['dst_y'], $value['fontSize'], $value['rgba'], $value['max_w'], $value['font'], $value['weight'], $value['space'], $value['angle']);
+ }
+ return $this;
+ }
+
+ public function buildQr($text, $dst_x = 0, $dst_y = 0, $src_x = 0, $src_y = 0, $src_w = 0, $src_h = 0, $size = 4, $margin = 1, $level = 'L')
+ {
+ $this->setQrs($text, $level, $size, $margin, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h);
+ return $this;
+ }
+
+ public function buildQrMany($params = [])
+ {
+ foreach ($params as $value) {
+ $value['dst_x'] = isset($value['dst_x']) ? $value['dst_x'] : 0;
+ $value['dst_y'] = isset($value['dst_y']) ? $value['dst_y'] : 0;
+ $value['src_x'] = isset($value['src_x']) ? $value['src_x'] : 0;
+ $value['src_y'] = isset($value['src_y']) ? $value['src_y'] : 0;
+ $value['src_w'] = isset($value['src_w']) ? $value['src_w'] : 0;
+ $value['src_h'] = isset($value['src_h']) ? $value['src_h'] : 0;
+ $value['size'] = isset($value['size']) ? $value['size'] : 4;
+ $value['margin'] = isset($value['margin']) ? $value['margin'] : 1;
+ $value['level'] = isset($value['level']) ? $value['level'] : 'L';
+ $this->setQrs($value['text'], $value['level'], $value['size'], $value['margin'], $value['dst_x'], $value['dst_y'], $value['src_x'], $value['src_y'], $value['src_w'], $value['src_h']);
+ }
+ return $this;
+ }
+
+ public function buildLine($x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0, $rgba = [], $type = '', $weight = 1)
+ {
+ $line = [$x1, $y1, $x2, $y2, $rgba, $type, $weight];
+ $this->lines[] = $line;
+ $this->query->setQuery('line', $line);
+ return $this;
+ }
+
+ public function buildArc($cx = 0, $cy = 0, $w = 0, $h = 0, $s = 0, $e = 0, $rgba = [], $type = '', $style = '', $weight = 1)
+ {
+ $arc = [$cx, $cy, $w, $h, $s, $e, $rgba, $type, $style, $weight];
+ $this->arcs = $arc;
+ $this->query->setQuery('arc', $arc);
+ return $this;
+ }
+
+ public function path($path)
+ {
+ $this->path = $path;
+ $this->query->setPath($path);
+ return $this;
+ }
+
+ public function getPoster($path = '')
+ {
+ $query = $this->query->getQuery();
+ return $this->extension->getPoster($query, $path);
+ }
+
+ public function setPoster()
+ {
+ $query = $this->query->getQuery();
+ return $this->extension->setPoster($query);
+ }
+
+ public function stream()
+ {
+ $query = $this->query->getQuery();
+ return $this->extension->stream($query);
+ }
+
+ public function baseData()
+ {
+ $query = $this->query->getQuery();
+ return $this->extension->baseData($query);
+ }
+
+ public function getIm()
+ {
+ $query = $this->query->getQuery();
+ return $this->extension->getIm($query);
+ }
+
+ public function getImInfo()
+ {
+ $query = $this->query->getQuery();
+ return $this->extension->getImInfo($query);
+ }
+
+ public function blob()
+ {
+ $query = $this->query->getQuery();
+ return $this->extension->blob($query);
+ }
+
+ public function tmp()
+ {
+ $query = $this->query->getQuery();
+ return $this->extension->tmp($query);
+ }
+
+ public function crop($x = 0, $y = 0, $width = 0, $height = 0)
+ {
+ $crop = [$x, $y, $width, $height];
+ $this->query->setQuery('crop', $crop);
+ return $this;
+ }
+
+ protected function setImages(...$params)
+ {
+ $this->images[] = $params;
+ $this->query->setQuery('image', $params);
+ }
+
+ protected function setTexts(...$params)
+ {
+ $this->texts[] = $params;
+ $this->query->setQuery('text', $params);
+ }
+
+ protected function setQrs(...$params)
+ {
+ $this->qrs[] = $params;
+ $this->query->setQuery('qrs', $params);
+ }
+
+ public function __clone()
+ {
+ $this->query = clone $this->query;
+ }
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/Image/Drivers/Driver.php b/niucloud/vendor/kkokk/poster/src/Image/Drivers/Driver.php
new file mode 100644
index 000000000..4ab68b87e
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Image/Drivers/Driver.php
@@ -0,0 +1,758 @@
+ 'imagegif',
+ 'jpeg' => 'imagejpeg',
+ 'jpg' => 'imagejpeg',
+ 'png' => 'imagepng',
+ 'wbmp' => 'imagewbmp'
+ ];
+
+ /** @var array|null 返回结果 */
+ public $result = null;
+
+ /**
+ * 设置基本配置
+ * @Author lang
+ * @Email : 732853989@qq.com
+ * Date: 2023/2/12
+ * Time: 下午10:09
+ * @param array $params
+ * @throws PosterException
+ */
+ public function setConfig($params = [])
+ {
+ isset($params['path']) && !empty($params['path']) && $this->setFilePath($params['path']);
+ isset($params['font_family']) && !empty($params['font_family']) && $this->font = $params['font_family'];
+ isset($params['font_size']) && !empty($params['font_size']) && $this->font_size = $params['font_size'];
+ isset($params['font_rgba']) && !empty($params['font_rgba']) && $this->font_rgba = $params['font_rgba'];
+ isset($params['font_space']) && !empty($params['font_space']) && $this->font_space = $params['font_space'];
+ isset($params['font_weight']) && !empty($params['font_weight']) && $this->font_weight = $params['font_weight'];
+ isset($params['font_angle']) && !empty($params['font_angle']) && $this->font_angle = $params['font_angle'];
+ isset($params['font_max_w']) && !empty($params['font_max_w']) && $this->font_max_w = $params['font_max_w'];
+
+ if (isset($params['dpi']) && !empty($params['dpi'])) {
+ $this->dpi = is_numeric($params['dpi']) ? [$params['dpi'], $params['dpi']] : $params['dpi'];
+ }
+ if (isset($params['font']) && !empty($params['font'])) {
+ $this->font = $this->getRealRoute($params['font']);
+ }
+ }
+
+ /**
+ * 设置文件路径
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2022/12/12
+ * Time: 9:55
+ * @param $path
+ * @throws PosterException
+ */
+ public function setFilePath($path)
+ {
+ $path = is_array($path) ? $path : [$path];
+ $pathFileName = isset($path[0]) ? $path[0] : '';
+ $pathFileName = str_replace(['\\', DIRECTORY_SEPARATOR], DIRECTORY_SEPARATOR, $pathFileName);
+
+ $fileName = $pathFileName ?: time();
+ if (strripos($pathFileName, DIRECTORY_SEPARATOR) !== false) {
+ $this->setPathName($pathFileName);
+ $fileName = substr($pathFileName, strripos($pathFileName, DIRECTORY_SEPARATOR) + 1);
+ }
+ $this->setFileName($fileName);
+ $this->setPath($pathFileName);
+ }
+
+ /**
+ * setFileName 设置文件名
+ * @Author lang
+ * @Date 2022-03-10T15:42:06+0800
+ * @param [type] $fileName [description]
+ */
+ public function setFileName($fileName)
+ {
+ $this->filename = $fileName;
+ if (strripos($this->filename, '.') !== false) {
+ $this->type = substr($this->filename, strripos($this->filename, '.') + 1);
+ if (!in_array($this->type, ['jpeg', 'jpg', 'png', 'gif', 'wbmp'])) {
+ throw new PosterException('The file naming format is incorrect');
+ }
+ }
+ }
+
+ /**
+ * setPathName 设置目录名
+ * @Author lang
+ * @Date 2022-03-10T15:42:19+0800
+ * @param [type] $fileName [description]
+ */
+ public function setPathName($pathFileName)
+ {
+ $this->pathname = substr($pathFileName, 0, strripos($pathFileName, DIRECTORY_SEPARATOR));
+ }
+
+ /**
+ * setPath 设置文件位置
+ * @Author lang
+ * @Date 2022-03-10T15:42:38+0800
+ * @param [type] $fileName [description]
+ */
+ public function setPath($pathFileName)
+ {
+ // 绝对路径 or 相对路径
+ $absolute = $this->isAbsolute($pathFileName);
+ $this->path = $this->getDocumentRoot();
+ $this->path = $absolute ? '' : ($this->path ?: __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR);
+ }
+
+ /**
+ * 获取项目根目录
+ * @Author lang
+ * @Date 2022-03-10T15:42:38+0800
+ */
+ public function getDocumentRoot()
+ {
+ $documentRoot = iconv('UTF-8', 'GBK', $_SERVER['DOCUMENT_ROOT']);
+
+ return $documentRoot ? $documentRoot . DIRECTORY_SEPARATOR : '';
+ }
+
+ /**
+ * 判断是否是绝对路径
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2022/12/12
+ * Time: 9:54
+ * @param $pathFileName
+ * @return bool
+ */
+ public function isAbsolute($pathFileName)
+ {
+ // 区分WIN系统绝对路径、暂时只区分linux win mac
+ switch (PHP_OS) {
+ case 'Darwin':
+ $absolute = stripos($pathFileName, DIRECTORY_SEPARATOR) === 0 ?: false;
+ break;
+ case 'linux':
+ default:
+ if (stripos(PHP_OS, 'WIN') !== false) {
+ $absolute = substr($pathFileName, 1, 1) === ':' ?: false;
+ } else {
+ $absolute = stripos($pathFileName, DIRECTORY_SEPARATOR) === 0 ?: false;
+ }
+ break;
+ }
+
+ return $absolute;
+ }
+
+ /**
+ * 获取真实路径
+ * @Author lang
+ * @Email : 732853989@qq.com
+ * Date: 2023/5/2
+ * Time: 上午9:35
+ * @param $path
+ * @return false|string
+ */
+ public function getRealRoute($path)
+ {
+ $isAbsolute = $this->isAbsolute($path);
+
+ if ($this->isCli() && !$isAbsolute) {
+ throw new PosterException('For cli environment, please pass the absolute path');
+ }
+
+ return !$isAbsolute ? $this->getDocumentRoot() . $path : realpath($path);
+ }
+
+ public function isCli()
+ {
+ return php_sapi_name() === 'cli';
+ }
+
+ /**
+ * 检查文件是否存在并创建
+ * @Author lang
+ * @Date 2020-08-14T15:32:04+0800
+ * @param string $pathname 路径名称
+ */
+ public function dirExists($pathname)
+ {
+ if (!file_exists($this->path . $pathname)) {
+ mkdir($this->path . $pathname, 0777, true);
+ }
+ }
+
+ /**
+ * 生成二维码
+ * @Author lang
+ * @Date 2020-10-14T10:59:28+0800
+ * @param [type] $text [二维码包含的内容,可以是链接、文字、json字符串等等]
+ * @param [type] $outfile [默认为false,不生成文件,只将二维码图片返回输出;否则需要给出存放生成二维码图片的文件名及路径]
+ * @param [type] $level [容错级别,默认为L]
+ * 可传递的值分别是L(QR_ECLEVEL_L,7%)、M(QR_ECLEVEL_M,15%)、Q(QR_ECLEVEL_Q,25%)、H(QR_ECLEVEL_H,30%)。
+ * 这个参数控制二维码容错率,不同的参数表示二维码可被覆盖的区域百分比,也就是被覆盖的区域还能识别
+ * @param [type] $size [控制生成图片的大小,默认为4]
+ * @param [type] $margin [控制生成二维码的空白区域大小]
+ * @param [type] $saveAndPrint [保存二维码图片并显示出来,$outfile必须传递图片路径]
+ * @return array|void
+ */
+ public function createQr($text, $outfile, $level, $size, $margin, $saveAndPrint)
+ {
+ if ($outfile) {
+ $this->setPath($outfile);
+ $this->setPathName($outfile);
+ $this->dirExists($this->pathname);
+ \QRcode::png($text, $this->path . $outfile, $level, $size, $margin, $saveAndPrint);
+ return ['url' => $outfile];
+ } else {
+ \QRcode::png($text, $outfile, $level, $size, $margin, $saveAndPrint);
+ }
+
+ }
+
+ /**
+ * 计算画布X轴位置
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2022/10/18
+ * Time: 16:10
+ * @return int
+ */
+ protected function calcDstX($dst_x, $imWidth, $bgWidth)
+ {
+ if ($dst_x == '0') {
+ return $dst_x;
+ } elseif ($dst_x === 'center') {
+
+ $dst_x = ceil(($imWidth - $bgWidth) / 2);
+
+ } elseif (is_numeric($dst_x) && $dst_x < 0) {
+
+ $dst_x = ceil($imWidth + $dst_x);
+
+ } elseif (is_array($dst_x)) {
+ if ($dst_x[0] == 'center') {
+ $dst_x = ceil(($imWidth - $bgWidth) / 2) + $dst_x[1];
+ }
+ } elseif (strpos($dst_x, '%') !== false) {
+
+ if (substr($dst_x, 0, strpos($dst_x, '%')) < 0) {
+
+ $dst_x = ceil($imWidth + ($imWidth * substr($dst_x, 0, strpos($dst_x, '%')) / 100));
+
+ } else {
+
+ $dst_x = ceil($imWidth * substr($dst_x, 0, strpos($dst_x, '%')) / 100);
+
+ }
+
+ }
+
+ return $dst_x;
+ }
+
+ /**
+ * 计算画布Y轴位置
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2022/10/18
+ * Time: 16:10
+ * @return int
+ */
+ protected function calcDstY($dst_y, $imHeight, $bgHeight)
+ {
+ if ($dst_y == '0') {
+ return $dst_y;
+ } elseif ($dst_y == 'center') {
+
+ $dst_y = ceil(($imHeight - $bgHeight) / 2);
+
+ } elseif (is_numeric($dst_y) && $dst_y < 0) {
+
+ $dst_y = ceil($imHeight + $dst_y);
+
+ } elseif (is_array($dst_y)) {
+
+ if ($dst_y[0] == 'center') {
+
+ $dst_y = ceil(($imHeight - $bgHeight) / 2) + $dst_y[1];
+
+ }
+ } elseif (strpos($dst_y, '%') !== false) {
+
+ if (substr($dst_y, 0, strpos($dst_y, '%')) < 0) {
+
+ $dst_y = ceil($imHeight + (($imHeight * substr($dst_y, 0, strpos($dst_y, '%'))) / 100));
+
+ } else {
+
+ $dst_y = ceil($imHeight * substr($dst_y, 0, strpos($dst_y, '%')) / 100);
+
+ }
+ }
+
+ return $dst_y;
+ }
+
+ /**
+ * 计算文字x轴坐标
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2023/2/13
+ * Time: 14:15
+ * @param $dst_x
+ * @param $fontBox
+ * @param null $x1
+ * @param null $x2
+ * @return false|float|int|mixed
+ */
+ protected function calcTextDstX($dst_x, $calcFont, $x1 = null, $x2 = null)
+ {
+ $fontBoxWidth = $calcFont['text_width'];
+ $imWidth = ($x1 !== null && $x2 !== null) ?
+ ($x2 - $x1)
+ : $this->im_w;
+ if ($dst_x === 'center') {
+ // 如果文字宽度大于 画布宽度 则为0
+ $dst_x = ceil(max(0, ($imWidth - $fontBoxWidth)) / 2);
+ } elseif (is_array($dst_x)) {
+ $dst_x[1] = isset($dst_x[1]) ? $dst_x[1] : 0;
+ $x1 = $x1 !== null ? $x1 : 0;
+ switch ($dst_x[0]) {
+ case 'center':
+ $dst_x = ceil(max(0, ($imWidth - $fontBoxWidth)) / 2) + $x1 + $dst_x[1];
+ break;
+ case 'left': // 左对齐 且 左右偏移
+ $dst_x = $x1 + $dst_x[1];
+ break;
+ case 'right': // 右对齐 且 左右偏移
+ $dst_x = ceil(($imWidth - $fontBoxWidth)) + $x1 + $dst_x[1];
+ break;
+ case 'custom': // 设置 自定义宽度居中 ['custom', 'center|top|bottom', $x1, $x2, $offset] $x1 区间起点宽度 $x2 区间终点宽度 $offset 偏移
+ $custom = [$dst_x[1], isset($dst_x[4]) ? $dst_x[4] : 0];
+ $dst_x = $this->calcTextDstX($custom, $calcFont, $dst_x[2], $dst_x[3]);
+ break;
+ default:
+ $dst_x = 0;
+ }
+
+ } elseif (strpos($dst_x, '%') !== false) {
+
+ if (substr($dst_x, 0, strpos($dst_x, '%')) < 0) {
+
+ $dst_x = ceil($imWidth + ($imWidth * substr($dst_x, 0, strpos($dst_x, '%')) / 100));
+
+ } else {
+
+ $dst_x = ceil($imWidth * substr($dst_x, 0, strpos($dst_x, '%')) / 100);
+
+ }
+ }
+
+ return $dst_x;
+ }
+
+ /**
+ * 计算文字y轴坐标
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2023/2/13
+ * Time: 14:14
+ * @param $dst_y
+ * @param $fontBox
+ * @param null $y1
+ * @param null $y2
+ * @return false|float|int|mixed
+ */
+ protected function calcTextDstY($dst_y, $calcFont, $y1 = null, $y2 = null)
+ {
+ $fontBoxHeight = $calcFont['text_height']; // 文字加换行数的高度
+ $imHeight = ($y1 !== null && $y2 !== null) ?
+ ($y2 - $y1)
+ : $this->im_h;
+ if ($dst_y === 'center') {
+ $dst_y = ceil(max(0, ($imHeight / 2) + ($fontBoxHeight / 2) - $fontBoxHeight));
+ } elseif (is_array($dst_y)) {
+ $dst_y[1] = isset($dst_y[1]) ? $dst_y[1] : 0;
+ $y1 = $y1 !== null ? $y1 : 0;
+ switch ($dst_y[0]) {
+ case 'center':
+ $dst_y = ceil(max(0, ($imHeight / 2) + ($fontBoxHeight / 2) - $fontBoxHeight)) + $y1 + $dst_y[1];
+ break;
+ case 'top': // 顶对齐 且 上下偏移
+ $dst_y = $y1 + $dst_y[1];
+ break;
+ case 'bottom': // 底对齐 且 上下偏移
+ $dst_y = ceil(($imHeight - $fontBoxHeight)) + $y1 + $dst_y[1];
+ break;
+ case 'custom': // 设置 自定义高度居中 ['custom', 'center|top|bottom', $y1, $y2, $offset] $y1 区间起点高度 $y2 区间终点高度 $offset 偏移
+ $custom = [$dst_y[1], isset($dst_y[4]) ? $dst_y[4] : 0];
+ $dst_y = $this->calcTextDstY($custom, $calcFont, $dst_y[2], $dst_y[3]);
+ break;
+ default:
+ $dst_y = 0;
+ }
+
+ } elseif (strpos($dst_y, '%') !== false) {
+
+ if (substr($dst_y, 0, strpos($dst_y, '%')) < 0) {
+
+ $dst_y = ceil($imHeight + (($imHeight * substr($dst_y, 0, strpos($dst_y, '%'))) / 100));
+
+ } else {
+
+ $dst_y = ceil($imHeight * substr($dst_y, 0, strpos($dst_y, '%')) / 100);
+
+ }
+ }
+
+ return $dst_y;
+ }
+
+ /**
+ * 计算加粗绘画
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2023/3/27
+ * Time: 16:46
+ * @param int $i 当前循环次数
+ * @param int $weight 循环次数
+ * @param int $fontSize 字体大小
+ * @param int $dst_x x 位置
+ * @param int $dst_y y 位置
+ * @return array|float[]
+ */
+ protected function calcWeight($i, $weight, $fontSize, $dst_x, $dst_y)
+ {
+ if ($weight % 2 == 0 && $i > 0) {
+ $really_dst_x = $dst_x + ($i * 0.25);
+ $really_dst_y = $dst_y + $fontSize;
+ } elseif ($weight % 2 != 0 && $i > 0) {
+ $really_dst_x = $dst_x;
+ $really_dst_y = $dst_y + $fontSize + ($i * 0.25);
+ } else {
+ $really_dst_x = $dst_x;
+ $really_dst_y = $dst_y + $fontSize;
+ }
+ return [$really_dst_x, $really_dst_y];
+ }
+
+ public function run($item, Driver $driver)
+ {
+ switch ($item['type']) {
+ case 'im':
+ $driver->Im(...$item['params']);
+ break;
+ case 'imDst':
+ $driver->ImDst(...$item['params']);
+ break;
+ case 'bg':
+ $driver->Bg(...$item['params']);
+ break;
+ case 'config':
+ $driver->setConfig($item['params']);
+ break;
+ case 'path':
+ $driver->setFilePath($item['params']);
+ break;
+ case 'image':
+ $driver->CopyImage(...$item['params']);
+ break;
+ case 'text':
+ $driver->CopyText(...$item['params']);
+ break;
+ case 'line':
+ $driver->CopyLine(...$item['params']);
+ break;
+ case 'arc':
+ $driver->CopyArc(...$item['params']);
+ break;
+ case 'qrs':
+ $driver->CopyQr(...$item['params']);
+ break;
+ case 'qr':
+ $driver->result = $driver->createQr(...$item['params']);
+ break;
+ case 'crop':
+ $driver->crop(...$item['params']);
+ break;
+ }
+ }
+
+ /**
+ * 根据传值类型获取四个角的半径
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2022/11/12
+ * Time: 15:39
+ * @param $radius string|array|integer '20 10' [20, 10] 10
+ * @param $len
+ * @return false[]|float[]
+ */
+ protected function getRadiusType($radius, $len)
+ {
+ if (is_string($radius)) {
+ // 把字符串格式转数组
+ $radius = preg_replace('~\s+~', ' ', trim($radius, ' '));
+ $radius = explode(' ', $radius);
+ } elseif (is_numeric($radius)) {
+ // 整形转数组
+ $radius = [$radius, $radius, $radius, $radius];
+ } else {
+ if (!is_array($radius)) {
+ throw new PosterException('圆角参数类型错误');
+ }
+ }
+ // [20] 四个角
+ // [20,30] 第一个值 左上 右下 第二个值 右上 左下
+ // [20,30,20] 第一个值 左上 第二个值 右上 左下 第三个值 右下
+ // [20,30,20,10] 左上 右上 右下 左下
+ $radiusCount = count($radius);
+ if ($radiusCount == 1) {
+ $leftTopRadius = $this->getMaxRadius($len, $radius[0]);
+ $rightTopRadius = $this->getMaxRadius($len, $radius[0]);
+ $leftBottomRadius = $this->getMaxRadius($len, $radius[0]);
+ $rightBottomRadius = $this->getMaxRadius($len, $radius[0]);
+ } elseif ($radiusCount == 2) {
+ $leftTopRadius = $this->getMaxRadius($len, $radius[0]);
+ $rightBottomRadius = $this->getMaxRadius($len, $radius[0]);
+ $rightTopRadius = $this->getMaxRadius($len, $radius[1]);
+ $leftBottomRadius = $this->getMaxRadius($len, $radius[1]);
+ } elseif ($radiusCount == 3) {
+ $leftTopRadius = $this->getMaxRadius($len, $radius[0]);
+ $rightTopRadius = $this->getMaxRadius($len, $radius[1]);
+ $leftBottomRadius = $this->getMaxRadius($len, $radius[1]);
+ $rightBottomRadius = $this->getMaxRadius($len, $radius[2]);
+ } else {
+ $leftTopRadius = $this->getMaxRadius($len, $radius[0]);
+ $rightTopRadius = $this->getMaxRadius($len, $radius[1]);
+ $leftBottomRadius = $this->getMaxRadius($len, $radius[2]);
+ $rightBottomRadius = $this->getMaxRadius($len, $radius[3]);
+ }
+
+ return [$leftTopRadius, $rightTopRadius, $leftBottomRadius, $rightBottomRadius];
+ }
+
+ /**
+ * 获取最大圆角半径
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2022/11/12
+ * Time: 15:14
+ * @param $len
+ * @param $radius
+ * @return false|float
+ */
+ protected function getMaxRadius($len, $radius)
+ {
+ return $radius < $len ? floor($radius) : floor($len);
+ }
+
+ /**
+ * 获取图片信息
+ * Author: lang
+ * Date: 2024/3/12
+ * Time: 11:08
+ * @return mixed
+ */
+ public function getImInfo()
+ {
+ return [
+ 'type' => $this->type,
+ 'width' => $this->im_w,
+ 'height' => $this->im_h,
+ ];
+ }
+
+ public function domHtml($content)
+ {
+ $dom = new \DOMDocument();
+
+ $dom->loadHTML('' . $content);
+
+ $xpath = new \DOMXPath($dom);
+
+ // 获取所有的 h1 标签
+ $spanTags = $xpath->query('//span');
+ $textNodes = $xpath->query("//text()");
+
+ // 遍历 h1 标签并输出内容
+ foreach ($spanTags as $tag) {
+ // echo $tag->nodeValue; // 输出标签内的文本内容
+ $style = $tag->getAttribute('style'); // 获取 style 属性值
+
+ $styles = explode(';', $style);
+
+ foreach ($styles as $style) {
+ $styleParts = explode(':', $style);
+ $property = trim($styleParts[0]);
+ $value = trim($styleParts[1]);
+
+ if ($property === 'color') {
+ echo $value; // 输出 color 值
+ }
+ }
+ echo $style;
+ echo $tag->nodeValue;
+ }
+
+ // 输出选中节点的文本内容
+ foreach ($textNodes as $node) {
+ echo $node->nodeValue;
+ }
+ print_r($textNodes);
+ exit;
+ }
+
+ public function getStyleAttr($style, $type = 'color')
+ {
+ $attr = '';
+
+ $styles = explode(';', $style);
+
+ foreach ($styles as $style) {
+ $styleParts = explode(':', $style);
+ $property = trim($styleParts[0]);
+ if (isset($styleParts[1])) {
+ $value = trim($styleParts[1]);
+ } else {
+ $value = '';
+ }
+
+ if ($property === $type) {
+ $attr = $value; // 输出属性值
+ }
+ }
+
+ return $attr;
+ }
+
+ /**
+ * 获取单个字属性
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2023/6/2
+ * Time: 15:38
+ * @param string $content
+ * @param string $color
+ * @param int $w
+ * @return array
+ */
+ public function getLetterArr($content = "\n", $color = '', $w = 0)
+ {
+ return [
+ 'color' => $color,
+ 'w' => $w,
+ 'value' => $content
+ ];
+ }
+
+ /**
+ * 获取内容
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2023/6/2
+ * Time: 15:37
+ * @param $letter
+ * @param $content
+ * @param string $color
+ */
+ public function getNodeValue(&$letter, $content, $color = '')
+ {
+ $contents = $this->getBrNodeValue($content);
+ foreach ($contents as $k => $v) {
+ if ($v != '') {
+ if (isset($contents[$k - 1])) {
+ $letter[] = $this->getLetterArr();
+ }
+
+ for ($i = 0; $i < mb_strlen($v); $i++) {
+ $letter[] = $this->getLetterArr(mb_substr($v, $i, 1), $color);
+ }
+ } else {
+ if ($k != 0) {
+ $letter[] = $this->getLetterArr();
+ }
+ }
+
+ }
+ }
+
+ /**
+ * 匹配换行符
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2023/6/2
+ * Time: 15:37
+ * @param $content
+ * @return array|false|string[]
+ */
+ public function getBrNodeValue($content)
+ {
+ $pattern = '/
|
/i';
+ // 分割字符串
+ return preg_split($pattern, $content, -1, 2);
+ }
+
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/Image/Drivers/DriverInterface.php b/niucloud/vendor/kkokk/poster/src/Image/Drivers/DriverInterface.php
new file mode 100644
index 000000000..58b24266c
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Image/Drivers/DriverInterface.php
@@ -0,0 +1,288 @@
+common = new Common();
+ }
+
+ public function getData($path = '')
+ {
+ if ($path) {
+ $this->setFilePath($path);
+ }
+ return $this->returnImage($this->type);
+ }
+
+ public function getStream()
+ {
+ return $this->returnImage($this->type, false);
+ }
+
+ public function getBaseData()
+ {
+ return $this->common->baseData($this->im, $this->type);
+ }
+
+ public function setData()
+ {
+ return $this->setImage($this->source);
+ }
+
+ public function getIm()
+ {
+ return $this->im;
+ }
+
+ public function blob()
+ {
+ return $this->getBlob($this->type, $this->im);
+ }
+
+ public function tmp()
+ {
+ return $this->getTmp($this->type, $this->im);
+ }
+
+ /**
+ * 创建指定宽高,颜色,透明的画布
+ */
+ public function Im($w, $h, $rgba = [255, 255, 255, 1], $alpha = false)
+ {
+ $this->im_w = $w;
+ $this->im_h = $h;
+ $this->im = $this->createIm($w, $h, $rgba, $alpha);
+ }
+
+ /**
+ * 创建指定图片为画布 宽高,颜色,透明的画布
+ */
+ public function ImDst($source, $w = 0, $h = 0)
+ {
+ $this->source = $source;
+ list($cut, $bgWidth, $bgHeight) = $this->createImage($source);
+
+ //设定水印图像的混色模式
+ imagealphablending($cut, true);
+
+ if (!empty($w) && !empty($h)) {
+ $this->im_w = $w;
+ $this->im_h = $h;
+ $circle_new = $this->createIm($w, $h, [255, 255, 255, 127], true);
+ imagecopyresized($circle_new, $cut, 0, 0, 0, 0, $w, $h, $bgWidth, $bgHeight);
+ $cut = $circle_new;
+ // $this->destroyImage($circle_new);
+ } else {
+ $this->im_w = $bgWidth;
+ $this->im_h = $bgHeight;
+ $circle_new = $this->createIm($bgWidth, $bgHeight, [255, 255, 255, 127], true);
+ imagecopy($circle_new, $cut, 0, 0, 0, 0, $bgWidth, $bgHeight);
+ $cut = $circle_new;
+ }
+
+ $this->im = $cut;
+ }
+
+ /**
+ * 创建背景
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2023/3/25
+ * Time: 17:55
+ * @param int $w 宽
+ * @param int $h 高
+ * @param array $rgba 背景颜色
+ * @param false $alpha 是否透明
+ * @param int $dst_x
+ * @param int $dst_y
+ * @param int $src_x
+ * @param int $src_y
+ * @param array $query
+ */
+ public function Bg($w, $h, $rgba = [], $alpha = false, $dst_x = 0, $dst_y = 0, $src_x = 0, $src_y = 0, $query = [])
+ {
+ // 判断颜色是否渐变
+ $rgbaColor = isset($rgba['color']) ? $rgba['color'] : [[0, 0, 0]];
+ $alphas = isset($rgba['alpha']) ? $rgba['alpha'] : 1;
+ $to = isset($rgba['to']) ? $rgba['to'] : 'bottom';
+ $radius = isset($rgba['radius']) ? $rgba['radius'] : 0;
+ $contentAlpha = isset($rgba['content_alpha']) ? $rgba['content_alpha'] : false;
+ $rgbaCount = count($rgbaColor);
+
+ // im不存在则创建
+ if (empty($this->im)) {
+ $this->Im($w, $h, [], $alpha);
+ }
+ // 渐变处理->直接处理im
+ // 计算颜色方向
+ $pic = $this->createIm($w, $h, [], $alpha);
+ $this->calcColorDirection($pic, $rgbaColor, $rgbaCount, $to, $w, $h);
+
+ // 设置透明度,内容不透明
+ if ($alpha && !$contentAlpha) {
+ $pic = $this->setImageAlpha($pic, $w, $h, $alphas);
+ }
+
+ $dst_x = $this->calcDstX($dst_x, $this->im_w, $w);
+ $dst_y = $this->calcDstY($dst_y, $this->im_h, $h);
+
+ if (!empty($query)) {
+ $that = clone $this;
+ $that->im = $pic;
+ $that->im_w = $w;
+ $that->im_h = $h;
+ $that->execute($query, $that);
+ }
+
+ // 设置透明度内容也透明
+ if ($alpha && $contentAlpha) {
+ $pic = $this->setImageAlpha($pic, $w, $h, $alphas);
+ }
+
+ // 如果设置了圆角则画圆角
+ if ($radius) {
+ $pic = $this->setPixelRadius($pic, $w, $h, $radius);
+ }
+
+ imagecopy($this->im, $pic, $dst_x, $dst_y, $src_x, $src_y, $w, $h);
+
+ if (isset($pic) && is_resource($pic)) {
+ $this->destroyImage($pic);
+ }
+ if (isset($mask) && is_resource($mask)) {
+ $this->destroyImage($mask);
+ }
+ unset($rgbaCount);
+ unset($rgbaColor);
+ unset($alphas);
+ unset($to);
+ unset($w);
+ unset($h);
+ unset($rgba);
+ unset($alpha);
+ unset($dst_x);
+ unset($dst_y);
+ unset($src_x);
+ unset($src_y);
+ }
+
+ public function getRotatedPoints($x, $y, $angle)
+ {
+ $theta = deg2rad($angle);
+ $cs = cos($theta);
+ $sn = sin($theta);
+ $newX = $x * $cs - $y * $sn;
+ $newY = $x * $sn + $y * $cs;
+ return array($newX, $newY);
+ }
+
+ public function matrix_multiply($matrix1, $matrix2)
+ {
+ $result = array();
+ for ($i = 0; $i < 3; $i++) {
+ for ($j = 0; $j < 3; $j++) {
+ $sum = 0;
+ for ($k = 0; $k < 3; $k++) {
+ $sum += $matrix1[$i][$k] * $matrix2[$k][$j];
+ }
+ $result[$i][$j] = $sum;
+ }
+ }
+ return $result;
+ }
+
+ /**
+ * 创建图片,合并到画布,释放内存
+ */
+ public function CopyImage(
+ $src,
+ $dst_x = 0,
+ $dst_y = 0,
+ $src_x = 0,
+ $src_y = 0,
+ $src_w = 0,
+ $src_h = 0,
+ $alpha = false,
+ $type = 'normal'
+ ) {
+ $angle = 0;
+ if (empty($this->im)) {
+ throw new PosterException('im resources not be found');
+ }
+
+ if (is_array($src)) {
+ $angle = isset($src['angle']) ? $src['angle'] : 0;
+ $src = isset($src['src']) ? $src['src'] : '';
+ if (empty($src)) {
+ throw new PosterException('image resources cannot be empty (' . $src . ')');
+ }
+ }
+
+ list($pic, $Width, $Height) = $this->createImage($src);
+
+ $bgWidth = !empty($src_w) ? $src_w : $Width;
+ $bgHeight = !empty($src_h) ? $src_h : $Height;
+
+ switch ($type) {
+ case 'normal':
+
+ # 自定义宽高的时候
+ if (!empty($src_w) && !empty($src_h)) {
+ $circle_new = $this->createIm($bgWidth, $bgHeight, [255, 255, 255, 127], $alpha = true);
+ // $circle_new_white = imagecolorallocatealpha($circle_new, 255, 255, 255, 127);
+ // imagecolortransparent($circle_new,$circle_new_white);
+ // imagefill($circle_new, 0, 0, $circle_new_white);
+ $w_circle_new = $bgWidth;
+ $h_circle_new = $bgHeight;
+ # 按比例缩放
+ imagecopyresized($circle_new, $pic, 0, 0, 0, 0, $w_circle_new, $h_circle_new, $Width, $Height);
+ $pic = $circle_new;
+ }
+
+ break;
+ case 'circle':
+
+ $circle = $this->createIm($bgWidth, $bgHeight, [255, 255, 255, 127], $alpha = true);
+ $circle_new = $this->createIm($bgWidth, $bgHeight, [255, 255, 255, 127], $alpha = true);
+
+ $w_circle = $bgWidth;
+ $h_circle = $bgHeight;
+ # 按比例缩放
+ imagecopyresized($circle_new, $pic, 0, 0, 0, 0, $w_circle, $h_circle, $Width, $Height);
+
+ $r = ($w_circle / 2); //圆半径
+ for ($x = 0; $x < $w_circle; $x++) {
+ for ($y = 0; $y < $h_circle; $y++) {
+ $rgbColor = imagecolorat($circle_new, $x, $y);
+ // $thisColor = imagecolorsforindex($circle_new, $rgbColor); // imagecolorallocatealpha
+
+ if (((($x - $r) * ($x - $r) + ($y - $r) * ($y - $r)) < ($r * $r))) {
+
+ imagesetpixel($circle, $x, $y, $rgbColor);
+
+ }
+
+ // $newR = $r - 0.5;
+ // if (((($x - $newR) * ($x - $newR) + ($y - $newR) * ($y - $newR)) == ($newR * $newR))) {
+ // imagesetpixel($circle, $x + 1, $y, $rgbColor);
+ // imagesetpixel($circle, $x, $y + 1, $rgbColor);
+ // imagesetpixel($circle, $x + 1, $y + 1, $rgbColor);
+ // }
+ }
+ }
+
+ $pic = $circle;
+ break;
+ default:
+ # code...
+ break;
+ }
+ # 处理目标 x 轴
+ $dst_x = $this->calcDstX($dst_x, $this->im_w, $bgWidth);
+
+ # 处理目标 y 轴
+ $dst_y = $this->calcDstY($dst_y, $this->im_h, $bgHeight);
+
+ # 处理旋转
+ if ($angle > 0) {
+ $pic = imagerotate($pic, abs($angle % 360 - 360), $this->createColorAlpha($this->im));
+ //获取旋转后的宽高
+ $newWidth = imagesx($pic);
+ $newHeight = imagesy($pic);
+ if (empty($src_w)) {
+ $bgWidth = $newWidth;
+ } else {
+ if ($newWidth != $newHeight) {
+ $bgWidth = $newWidth;
+ }
+ $src_x = ceil(($newWidth - $bgWidth) / 2);
+ }
+ if (empty($src_h)) {
+ $bgHeight = $newHeight;
+ } else {
+ if ($newWidth != $newHeight) {
+ $bgHeight = $newHeight;
+ }
+ $src_y = ceil(($newHeight - $bgHeight) / 2);
+ }
+ }
+
+ //整合海报
+ imagecopy($this->im, $pic, $dst_x, $dst_y, $src_x, $src_y, $bgWidth, $bgHeight);
+
+ if (isset($pic) && is_resource($pic)) {
+ $this->destroyImage($pic);
+ }
+ if (isset($circle) && is_resource($circle)) {
+ $this->destroyImage($circle);
+ }
+ if (isset($circle_new) && is_resource($circle_new)) {
+ $this->destroyImage($circle_new);
+ }
+ unset($path);
+ unset($bgWidth);
+ unset($bgHeight);
+ unset($bgType);
+ }
+
+ /**
+ * 合并图片
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2022/12/12
+ * Time: 9:52
+ * @param $src
+ * @param $dst_x
+ * @param $dst_y
+ * @param $src_x
+ * @param $src_y
+ * @param $src_w
+ * @param $src_h
+ * @param false $alpha
+ * @param string $type
+ * @throws PosterException
+ */
+ public function CopyMergeImage(
+ $src,
+ $dst_x,
+ $dst_y,
+ $src_x,
+ $src_y,
+ $src_w,
+ $src_h,
+ $alpha = false,
+ $type = 'normal'
+ ) {
+ if (empty($this->im)) {
+ throw new PosterException('im resources not be found');
+ }
+
+ if (strpos($src, 'http') === false) {
+ $src = $this->getRealRoute($src);
+ }
+
+ list($Width, $Height, $bgType) = @getimagesize($src);
+ $bgType = image_type_to_extension($bgType, false);
+
+ if (empty($bgType)) {
+ throw new PosterException('image resources cannot be empty (' . $src . ')');
+ }
+
+ // if ($bgType == 'gif') {
+ // $pic = imagecreatefromstring(file_get_contents($src));
+ // } else {
+ //
+ // $fun = 'imagecreatefrom' . $bgType;
+ // $pic = @$fun($src);
+ // }
+
+ $fun = 'imagecreatefrom' . $bgType;
+ $pic = @$fun($src);
+
+ $bgWidth = !empty($src_w) ? $src_w : $Width;
+ $bgHeight = !empty($src_h) ? $src_h : $Height;
+
+ switch ($type) {
+ case 'normal':
+
+ $circle_new = $this->createIm($bgWidth, $bgHeight, [255, 255, 255, 127], $alpha = true);
+ //整合水印
+ imagecopy($circle_new, $pic, 0, 0, 0, 0, $bgWidth, $bgWidth);
+ # 自定义宽高的时候
+ if (!empty($src_w) && !empty($src_h)) {
+ // $circle_new_white = imagecolorallocatealpha($circle_new, 255, 255, 255, 127);
+ // imagecolortransparent($circle_new,$circle_new_white);
+ // imagefill($circle_new, 0, 0, $circle_new_white);
+ $w_circle_new = $bgWidth;
+ $h_circle_new = $bgHeight;
+ # 按比例缩放
+ imagecopyresized($circle_new, $pic, 0, 0, 0, 0, $w_circle_new, $h_circle_new, $Width, $Height);
+ $pic = $circle_new;
+ }
+
+ break;
+ case 'circle':
+
+ $circle = $this->createIm($bgWidth, $bgHeight, [255, 255, 255, 127], $alpha = true);
+ $circle_new = $this->createIm($bgWidth, $bgHeight, [255, 255, 255, 127], $alpha = true);
+
+ $w_circle = $bgWidth;
+ $h_circle = $bgHeight;
+ # 按比例缩放
+ imagecopyresized($circle_new, $pic, 0, 0, 0, 0, $w_circle, $h_circle, $Width, $Height);
+
+ $r = ($w_circle / 2); //圆半径
+ for ($x = 0; $x < $w_circle; $x++) {
+ for ($y = 0; $y < $h_circle; $y++) {
+ $rgbColor = imagecolorat($circle_new, $x, $y);
+ if (((($x - $r) * ($x - $r) + ($y - $r) * ($y - $r)) < ($r * $r))) {
+ imagesetpixel($circle, $x, $y, $rgbColor);
+ }
+ }
+ }
+
+ $pic = $circle;
+ break;
+ default:
+ # code...
+ break;
+ }
+
+ //整合水印
+ imagecopymerge($this->im, $pic, $dst_x, $dst_y, $src_x, $src_y, $bgWidth, $bgHeight, 100);
+
+ if (isset($circle) && is_resource($circle)) {
+ $this->destroyImage($circle);
+ }
+ if (isset($circle_new) && is_resource($circle_new)) {
+ $this->destroyImage($circle_new);
+ }
+ }
+
+ /**
+ * 合并文字
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2023/2/13
+ * Time: 15:33
+ * @param $content
+ * @param $dst_x
+ * @param $dst_y
+ * @param $fontSize
+ * @param $rgba
+ * @param int $max_w
+ * @param string $font
+ * @param int $weight
+ * @param int $space
+ * @return bool
+ * @throws PosterException
+ */
+ public function CopyText(
+ $content,
+ $dst_x = 0,
+ $dst_y = 0,
+ $fontSize = null,
+ $rgba = null,
+ $max_w = null,
+ $font = null,
+ $weight = null,
+ $space = null,
+ $angle = null
+ ) {
+ if ($content == '') {
+ return true;
+ }
+
+ if (empty($this->im)) {
+ throw new PosterException('im resources not be found');
+ }
+
+ $fontSize = $fontSize ?: $this->font_size;
+ $rgba = $rgba ?: $this->font_rgba;
+ $max_w = $max_w ?: $this->font_max_w;
+ $weight = $weight ?: $this->font_weight;
+ $space = $space ?: $this->font_space;
+ $angle = $angle ?: $this->font_angle;
+
+ if (!empty($font)) {
+ $font = $this->getRealRoute($font);
+ } else {
+ $font = $this->font;
+ }
+
+ $calcSpace = $space > $fontSize ? ($space - $fontSize) : 0; // 获取间距计算值
+
+ $fontSize = ($fontSize * 3) / 4; // px 转化为 pt
+
+ $color = $this->createColorAlpha($this->im, $rgba);
+
+ mb_internal_encoding('UTF-8'); // 设置编码
+
+ $max_ws = $this->im_w;
+ if (isset($max_w) && !empty($max_w)) {
+ $max_ws = $max_w;
+ }
+
+ // 这几个变量分别是 字体大小, 角度, 字体名称, 字符串, 预设宽度
+ $contents = '';
+ $contentsArr = [];
+ $letter = [];
+ $line = 1;
+ $calcSpaceRes = 0;
+
+ // 主动设置是否解析html标签
+ if (is_array($content)) {
+
+ if (!isset($content['type'])) {
+ throw new PosterException('type is required');
+ }
+ if (!isset($content['content'])) {
+ throw new PosterException('content is required');
+ }
+
+ $type = $content['type'];
+ $content = $content['content'];
+
+ // 确认包含才处理
+ if ($type == 'html' && preg_match('/<[^>]*>/', $content)) {
+
+ // 正则匹配 span 属性
+ $pattern = '/(.*?)<\/span>/i';
+
+ // 分割字符串
+ $matches = preg_split($pattern, $content, -1, PREG_SPLIT_DELIM_CAPTURE);
+
+ for ($i = 0; $i < count($matches); $i += 3) {
+ if (!empty($matches[$i])) {
+ $this->getNodeValue($letter, $matches[$i], $color);
+ }
+
+ if (isset($matches[$i + 1])) {
+ $style = $matches[$i + 1];
+ $colorValue = $this->getStyleAttr($style);
+ $colorCustom = $this->createColorAlpha($this->im,
+ $this->common->getNodeStyleColor($colorValue));
+ $this->getNodeValue($letter, $matches[$i + 2], $colorCustom);
+ }
+ }
+
+ } else {
+ $this->getNodeValue($letter, $content, $color);
+ }
+
+ $normalSize = imagettfbbox($fontSize, 0, $font, '好');
+ $punctuationSize = imagettfbbox($fontSize, 0, $font, ',');
+ // 计算标点符号的水平偏移量
+ $horizontalOffset = abs($punctuationSize[2] - $normalSize[2]) / 2;
+
+ $textWidthArr = [];
+ foreach ($letter as $l) {
+ $textStr = $contents . $l['value'];
+ $fontBox = imagettfbbox($fontSize, $angle, $font, $textStr);
+ $textWidth = abs($fontBox[2]) + $calcSpaceRes + 2;
+ if (preg_match('/[\x{3002}\x{ff0c}\x{ff1f}\x{ff01}\x{ff1a}\x{ff1b}]/u', $l['value'])) {
+ $textWidth += $horizontalOffset;
+ }
+
+ if ($l['value'] == "\n") {
+ $contents = "";
+ $contentsArr[] = $this->getLetterArr();
+ $line++;
+ continue;
+ }
+
+ if (!isset($textWidthArr[$line])) {
+ $textWidthArr[$line] = -$space / 2;
+ }
+ if (($textWidth > $max_ws || $textWidthArr[$line] > $max_ws) && ($contents !== '')) {
+ // 判断拼接后的字符串是否超过预设的宽度
+ $contents = "";
+ $contentsArr[] = $this->getLetterArr();
+ $line++;
+ $textWidthArr[$line] = -$space / 2;
+ }
+ $contents .= $l['value'];
+
+ $fontBox1 = imagettfbbox($fontSize, $angle, $font, $l['value']);
+ $l['w'] = abs($fontBox1[2]) + $calcSpace + 2;
+ if (preg_match('/[\x{3002}\x{ff0c}\x{ff1f}\x{ff01}\x{ff1a}\x{ff1b}]/u', $l['value'])) {
+ $l['w'] += $horizontalOffset;
+ }
+ $textWidthArr[$line] += $l['w'];
+ $contentsArr[] = $l;
+
+ $line === 1 && $calcSpaceRes += $calcSpace;
+ }
+
+ $calcFont = [
+ 'text_width' => max(array_values($textWidthArr)), // 取最宽行宽
+ 'text_height' => abs($fontBox[1] - $fontBox[7]),
+ ];
+ $dst_x = $this->calcTextDstX($dst_x, $calcFont);
+
+ $dst_y = $this->calcTextDstY($dst_y, $calcFont);
+ # 自定义间距
+ $this->fontWeightArr($weight, $fontSize, $angle, $dst_x, $dst_y, $color, $font, $contentsArr);
+
+ return true;
+
+ } else {
+ // 将字符串拆分成一个个单字 保存到数组 letter 中
+ for ($i = 0; $i < mb_strlen($content); $i++) {
+ $letter[] = mb_substr($content, $i, 1);
+ }
+
+ $textWidthArr = [];
+ $contentStr = '';
+ foreach ($letter as $l) {
+ $textStr = $contentStr . $l;
+ $fontBox = imagettfbbox($fontSize, $angle, $font, $textStr);
+ $textWidth = abs($fontBox[2]) + $calcSpaceRes;
+ $textWidthArr[$line] = $textWidth;
+ // 判断拼接后的字符串是否超过预设的宽度
+
+ if (($textWidth > $max_ws) && ($contents !== '')) {
+ $contents .= "\n";
+ $contentStr = "";
+ $line++;
+ }
+ $contents .= $l;
+ $contentStr .= $l;
+ $line === 1 && $calcSpaceRes += $calcSpace;
+
+ $calcFont = [
+ 'text_width' => max(array_values($textWidthArr)),
+ 'text_height' => abs($fontBox[1] - $fontBox[7]),
+ ];
+ }
+
+ $dst_x = $this->calcTextDstX($dst_x, $calcFont);
+
+ $dst_y = $this->calcTextDstY($dst_y, $calcFont);
+
+ # 自定义间距
+ if ($space > 0) {
+
+ $dst_x_old = $dst_x;
+ for ($j = 0; $j < mb_strlen($contents); $j++) {
+
+ $spaceStr = mb_substr($contents, $j, 1);
+ if ($spaceStr == "\n") {
+ $dst_x = $dst_x_old;
+ $dst_y += 1.75 * $fontSize;
+ continue;
+ }
+ $this->fontWeight($weight, $fontSize, $angle, $dst_x, $dst_y, $color, $font, $spaceStr);
+ $dst_x += $space;
+ }
+
+
+ } else {
+ $this->fontWeight($weight, $fontSize, $angle, $dst_x, $dst_y, $color, $font, $contents);
+ }
+
+ return true;
+ }
+ }
+
+ public function CopyLine($x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0, $rgba = [], $type = '', $weight = 1)
+ {
+ imagesetthickness($this->im, $weight); // 划线的线宽加粗
+ $color = $this->createColorAlpha($this->im, $rgba);
+
+ switch ($type) {
+ case 'rectangle':
+ imagerectangle($this->im, $x1, $y1, $x2, $y2, $color);
+ break;
+ case 'filled_rectangle':
+ case 'filledRectangle':
+ imagerectangle($this->im, $x1, $y1, $x2, $y2, $color);
+ imagefilledrectangle($this->im, $x1, $y1, $x2, $y2, $color);
+ break;
+ default:
+ imageline($this->im, $x1, $y1, $x2, $y2, $color);
+ break;
+ }
+ }
+
+ public function CopyArc(
+ $cx = 0,
+ $cy = 0,
+ $w = 0,
+ $h = 0,
+ $s = 0,
+ $e = 0,
+ $rgba = [],
+ $type = '',
+ $style = '',
+ $weight = 1
+ ) {
+ imagesetthickness($this->im, $weight); // 划线的线宽加粗
+ $color = $this->createColorAlpha($this->im, $rgba);
+
+ switch ($type) {
+ case 'filled_arc':
+ case 'filledArc':
+ imagearc($this->im, $cx, $cy, $w, $h, $s, $e, $color);
+ $style = $style ?: IMG_ARC_PIE;
+ // IMG_ARC_PIE
+ // IMG_ARC_CHORD
+ // IMG_ARC_NOFILL
+ // IMG_ARC_EDGED
+ imagefilledarc($this->im, $cx, $cy, $w, $h, $s, $e, $color, $style);
+ break;
+ default:
+ imagearc($this->im, $cx, $cy, $w, $h, $s, $e, $color);
+ break;
+ }
+ }
+
+ /**
+ * 合并二维码
+ * @Author lang
+ * @Date 2020-10-14T14:40:51+0800
+ * @param [type] $text [description]
+ * @param [type] $size [description]
+ * @param [type] $margin [description]
+ * @param [type] $dst_x [description]
+ * @param [type] $dst_y [description]
+ * @param [type] $src_x [description]
+ * @param [type] $src_y [description]
+ */
+ public function CopyQr(
+ $text,
+ $level = 'L',
+ $size = 4,
+ $margin = 1,
+ $dst_x = 0,
+ $dst_y = 0,
+ $src_x = 0,
+ $src_y = 0,
+ $src_w = 0,
+ $src_h = 0
+ ) {
+ if (empty($this->im)) {
+ throw new PosterException('im resources not be found');
+ }
+
+ $result = \QRcode::re_png($text, $level, $size, $margin);
+ if ($src_w > 0) {
+
+ $bgWidth = $src_w;
+ $Width = imagesx($result);
+ } else {
+
+ $bgWidth = imagesx($result);
+
+ }
+
+ if ($src_h > 0) {
+
+ $bgHeight = $src_h;
+ $Height = imagesy($result);
+ } else {
+
+ $bgHeight = imagesy($result);
+
+ }
+
+
+ # 处理目标 x 轴
+ $dst_x = $this->calcDstX($dst_x, $this->im_w, $bgWidth);
+
+
+ # 处理目标 y 轴
+ $dst_y = $this->calcDstY($dst_y, $this->im_h, $bgHeight);
+
+ # 自定义宽高的时候
+ if (!empty($src_w) && !empty($src_h)) {
+ $circle_new = $this->createIm($bgWidth, $bgHeight, [255, 255, 255, 127], $alpha = true);
+ // $circle_new_white = imagecolorallocatealpha($circle_new, 255, 255, 255, 127);
+ // imagecolortransparent($circle_new,$circle_new_white);
+ // imagefill($circle_new, 0, 0, $circle_new_white);
+ $w_circle_new = $bgWidth;
+ $h_circle_new = $bgHeight;
+ # 按比例缩放
+ imagecopyresized($circle_new, $result, 0, 0, 0, 0, $w_circle_new, $h_circle_new, $Width, $Height);
+ $result = $circle_new;
+ }
+
+
+ //整合海报
+ imagecopy($this->im, $result, $dst_x, $dst_y, $src_x, $src_y, $bgWidth, $bgHeight);
+ if (isset($circle_new) && is_resource($circle_new)) {
+ $this->destroyImage($circle_new);
+ }
+ if (isset($result) && is_resource($result)) {
+ $this->destroyImage($result);
+ }
+ }
+
+ /**
+ * 裁剪
+ * Author: lang
+ * Date: 2024/3/12
+ * Time: 11:22
+ * @param $x
+ * @param $y
+ * @param $width
+ * @param $height
+ */
+ public function crop($x = 0, $y = 0, $width = 0, $height = 0)
+ {
+ $this->im = imagecrop($this->im, ['x' => $x, 'y' => $y, 'width' => $width, 'height' => $height]);
+ $this->im_w = $width;
+ $this->im_h = $height;
+ }
+
+ public function execute($query = [], Driver $driver = null)
+ {
+ if (empty($driver)) {
+ $driver = $this;
+ }
+ foreach ($query as $item) {
+ $driver->run($item, $driver);
+ }
+ return $driver;
+ }
+
+ /**
+ * 释放资源
+ * @Author lang
+ * @Date 2020-08-14T14:29:46+0800
+ * @param Resource
+ */
+ protected function destroyImage($Resource)
+ {
+
+ !is_resource($Resource) || imagedestroy($Resource);
+ }
+
+ /**
+ * 析构方法,用于销毁图像资源
+ */
+ public function __destruct()
+ {
+ empty($this->im) || !is_resource($this->im) || imagedestroy($this->im);
+ }
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/Image/Drivers/ImagickDriver.php b/niucloud/vendor/kkokk/poster/src/Image/Drivers/ImagickDriver.php
new file mode 100644
index 000000000..77b1c35bb
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Image/Drivers/ImagickDriver.php
@@ -0,0 +1,632 @@
+setFilePath($path);
+ }
+ $this->setDPI();
+ return $this->returnImage($this->type);
+ }
+
+ public function getStream()
+ {
+ $this->setDPI();
+ return $this->returnImage($this->type, false);
+ }
+
+ public function getBaseData()
+ {
+ $this->setDPI();
+ $common = new Common();
+ return $common->baseData($this->im->getImageBlob(), $this->type);
+ }
+
+ public function getIm()
+ {
+ return $this->im;
+ }
+
+ public function blob()
+ {
+ $this->setDPI();
+ return $this->getBlob($this->im);
+ }
+
+ public function tmp()
+ {
+ return $this->getTmp($this->type, $this->im);
+ }
+
+ public function setData()
+ {
+ $this->setDPI();
+ return $this->setImage($this->source);
+ }
+
+ public function im($w, $h, $rgba = [255, 255, 255, 1], $alpha = false)
+ {
+ $this->im_w = $w;
+ $this->im_h = $h;
+ $this->im = $this->createIm($w, $h, $rgba, $alpha);
+ }
+
+ public function ImDst($source, $w = 0, $h = 0)
+ {
+ $this->source = $source;
+
+ $pic = $this->createImagick($source);
+
+ $bgWidth = $pic->getImageWidth();
+ $bgHeight = $pic->getImageHeight();
+ $this->type = strtolower($pic->getImageFormat());
+
+ if (!empty($w) && !empty($h)) {
+ $this->im_w = $w;
+ $this->im_h = $h;
+ $pic->resizeImage($w, $h, $pic::FILTER_LANCZOS, 1, true);
+ } else {
+ $this->im_w = $bgWidth;
+ $this->im_h = $bgHeight;
+ }
+
+ $this->im = $pic;
+ }
+
+ public function Bg($w, $h, $rgba = [], $alpha = false, $dst_x = 0, $dst_y = 0, $src_x = 0, $src_y = 0, $query = [])
+ {
+ // 判断颜色是否渐变
+ $rgbaColor = isset($rgba['color']) ? $rgba['color'] : [[0, 0, 0]];
+ $alphas = isset($rgba['alpha']) ? $rgba['alpha'] : 1;
+ $to = isset($rgba['to']) ? $rgba['to'] : 'bottom';
+ $radius = isset($rgba['radius']) ? $rgba['radius'] : 0;
+ $contentAlpha = isset($rgba['content_alpha']) ? $rgba['content_alpha'] : false;
+ $rgbaCount = count($rgbaColor);
+
+ // im不存在则创建
+ if (empty($this->im)) {
+ $this->im($w, $h, [], $alpha);
+ }
+ // 渐变处理->直接处理im
+ // 计算颜色方向
+ $pic = $this->createIm($w, $h, [], $alpha);
+ $this->calcColorDirection($pic, $rgbaColor, $rgbaCount, $to, $w, $h);
+
+ // 设置透明度,内容不透明
+ if ($alpha && !$contentAlpha) {
+ $this->setImageAlpha($pic, $alphas);
+ }
+
+ $dst_x = $this->calcDstX($dst_x, $this->im_w, $w);
+ $dst_y = $this->calcDstY($dst_y, $this->im_h, $h);
+
+ if (!empty($query)) {
+ $that = clone $this;
+ $that->im = $pic;
+ $that->im_w = $w;
+ $that->im_h = $h;
+ $that->execute($query, $that);
+
+ // 合并图片, 合并图片移到下方,这里不需要再合并
+ // $pic->compositeImage($that->im, ($that->im)::COMPOSITE_DEFAULT, $dst_x, $dst_y);
+ }
+
+ // 设置透明度,内容也透明
+ if ($alpha && $contentAlpha) {
+ $this->setImageAlpha($pic, $alphas);
+ }
+
+ if ($radius) {
+ // 圆角处理
+ $pic = $this->setPixelRadius($pic, $w, $h, $radius);
+ }
+
+ // 裁剪图片
+ $this->cropImage($pic, $src_x, $src_y);
+
+ // 合并图片
+ if ($this->type == 'gif') {
+ // 每帧长宽不一致问题, 水印会不一致
+ foreach ($this->im as $frame) {
+ $frame->compositeImage($pic, ($this->im)::COMPOSITE_DEFAULT, $dst_x, $dst_y);
+ }
+ } else {
+ $this->im->compositeImage($pic, ($this->im)::COMPOSITE_DEFAULT, $dst_x, $dst_y);
+ }
+
+ if ($that) {
+ unset($that);
+ }
+ $this->destroyImage($pic);
+ }
+
+ public function CopyImage(
+ $src,
+ $dst_x = 0,
+ $dst_y = 0,
+ $src_x = 0,
+ $src_y = 0,
+ $src_w = 0,
+ $src_h = 0,
+ $alpha = false,
+ $type = 'normal'
+ ) {
+ $angle = 0;
+ if (empty($this->im)) {
+ throw new PosterException('im resources not be found');
+ }
+
+ if (is_array($src)) {
+ $angle = isset($src['angle']) ? $src['angle'] : 0;
+ $src = isset($src['src']) ? $src['src'] : '';
+ if (empty($src)) {
+ throw new PosterException('image resources cannot be empty (' . $src . ')');
+ }
+ }
+
+ $pic = $this->createImagick($src);
+
+ $Width = $pic->getImageWidth();
+ $Height = $pic->getImageHeight();
+
+ $bgWidth = !empty($src_w) ? $src_w : $Width;
+ $bgHeight = !empty($src_h) ? $src_h : $Height;
+
+ switch ($type) {
+ case 'normal':
+ # 自定义宽高的时候
+ if (!empty($src_w) && !empty($src_h)) {
+ // $pic->resizeImage($bgWidth, $bgHeight, $pic::FILTER_LANCZOS, 1, true); // 等比缩放
+ $pic->scaleImage($bgWidth, $bgHeight);
+ }
+ break;
+ case 'circle':
+ if (!empty($src_w) && !empty($src_h)) {
+ // $pic->resizeImage($bgWidth, $bgHeight, $pic::FILTER_LANCZOS, 1, true); // 等比缩放
+ $pic->scaleImage($bgWidth, $bgHeight);
+ }
+
+ $pic->setImageFormat("png");
+ $pic->setImageMatte(true); // 激活遮罩通道
+
+ // 创建一个圆形遮罩图片
+
+ $mask = $this->createImagick();
+
+ $mask->newImage($bgWidth, $bgHeight, $this->createColorAlpha([255, 255, 255, 127]));
+
+ $circle = $this->createImagickDraw();
+ $circle->setFillColor($this->createColorAlpha([255, 255, 255, 1]));
+ $circle->circle($bgWidth / 2, $bgHeight / 2, $bgWidth / 2, $bgHeight);
+
+ $mask->drawImage($circle);
+
+ // 合并原始图片和圆形遮罩图片
+ $pic->compositeImage($mask, $pic::COMPOSITE_DSTIN, 0, 0);
+
+ $this->destroyImage($circle);
+ $this->destroyImage($mask);
+ break;
+ default:
+ # code...
+ break;
+ }
+
+ # 处理目标 x 轴
+ $dst_x = $this->calcDstX($dst_x, $this->im_w, $bgWidth);
+
+ # 处理目标 y 轴
+ $dst_y = $this->calcDstY($dst_y, $this->im_h, $bgHeight);
+
+ // 裁剪图片
+ $this->cropImage($pic, $src_x, $src_y);
+
+
+ # 处理旋转
+ if ($angle > 0) {
+ $pic->rotateimage($this->createColorAlpha(), $angle);
+ }
+
+
+ // 合并图片
+ if ($this->type == 'gif') {
+ // 每帧长宽不一致问题, 水印会不一致
+ foreach ($this->im as $frame) {
+ $frame->compositeImage($pic, ($this->im)::COMPOSITE_DEFAULT, $dst_x, $dst_y);
+ }
+ } else {
+ $this->im->compositeImage($pic, ($this->im)::COMPOSITE_DEFAULT, $dst_x, $dst_y);
+ }
+
+
+ $this->destroyImage($pic);
+ }
+
+ public function CopyText(
+ $content,
+ $dst_x = 0,
+ $dst_y = 0,
+ $fontSize = null,
+ $rgba = null,
+ $max_w = null,
+ $font = null,
+ $weight = null,
+ $space = null,
+ $angle = null
+ ) {
+ if ($content == '') {
+ return true;
+ }
+
+ if (empty($this->im)) {
+ throw new PosterException('im resources not be found');
+ }
+
+ $fontSize = $fontSize ?: $this->font_size;
+ $rgba = $rgba ?: $this->font_rgba;
+ $max_w = $max_w ?: $this->font_max_w;
+ $weight = $weight ?: $this->font_weight;
+ $space = $space ?: $this->font_space;
+ $angle = $angle ?: $this->font_angle;
+
+ if (!empty($font)) {
+ $font = $this->getRealRoute($font);
+ } else {
+ $font = $this->font;
+ }
+
+ $calcSpace = $space > $fontSize ? ($space - $fontSize) : 0; // 获取间距计算值
+
+ $color = $this->createColorAlpha($rgba);
+
+ $max_ws = $this->im_w;
+ if (isset($max_w) && !empty($max_w)) {
+ $max_ws = $max_w;
+ }
+
+ // 这几个变量分别是 字体大小, 角度, 字体名称, 字符串, 预设宽度
+ $contents = '';
+ $letter = [];
+ $line = 1;
+ $calcSpaceRes = 0;
+
+ $draw = $this->createTextImagickDraw();
+ $draw->setFont($font);
+ $draw->setFillColor($color);
+ $draw->setFontSize($fontSize);
+
+ $fontSize = ($fontSize * 3) / 4; // 使和gd一致
+
+ // 主动设置是否解析html标签
+ if (is_array($content)) {
+
+ if (!isset($content['type'])) {
+ throw new PosterException('type is required');
+ }
+ if (!isset($content['content'])) {
+ throw new PosterException('content is required');
+ }
+
+ $type = $content['type'];
+ $content = $content['content'];
+
+ // 确认包含才处理
+ if ($type == 'html' && preg_match('/<[^>]*>/', $content)) {
+
+ // 正则匹配 span 属性
+ $pattern = '/(.*?)<\/span>/i';
+
+ // 分割字符串
+ $matches = preg_split($pattern, $content, -1, PREG_SPLIT_DELIM_CAPTURE);
+
+ $common = new Common();
+
+ for ($i = 0; $i < count($matches); $i += 3) {
+ if (!empty($matches[$i])) {
+ $this->getNodeValue($letter, $matches[$i], $color);
+ }
+
+ if (isset($matches[$i + 1])) {
+ $style = $matches[$i + 1];
+ $colorValue = $this->getStyleAttr($style);
+ $colorCustom = $this->createColorAlpha($common->getNodeStyleColor($colorValue));
+ $this->getNodeValue($letter, $matches[$i + 2], $colorCustom);
+ }
+ }
+
+ } else {
+ $this->getNodeValue($letter, $content, $color);
+ }
+
+ $textWidthArr = [];
+ foreach ($letter as $l) {
+
+ $textStr = $contents . $l['value'];
+ $fontBox = $this->im->queryFontMetrics($draw, $textStr);
+ $textWidth = abs($fontBox['textWidth'] + $fontBox['descender']) + $calcSpaceRes;
+
+ if ($l['value'] == "\n") {
+ $contents = "";
+ $contentsArr[] = $this->getLetterArr();
+ $line++;
+ continue;
+ }
+
+ if (!isset($textWidthArr[$line])) {
+ $textWidthArr[$line] = -$space / 2;
+ }
+ // 判断拼接后的字符串是否超过预设的宽度
+ if (($textWidth > $max_ws || $textWidthArr[$line] > $max_ws) && ($contents !== '')) {
+ $contents .= "\n";
+ $contentsArr[] = $this->getLetterArr();
+ $line++;
+ }
+ $contents .= $l['value'];
+
+ $fontBox1 = $this->im->queryFontMetrics($draw, $l['value']);
+ $l['w'] = abs($fontBox1['textWidth'] + $fontBox1['descender']) + $calcSpace;
+ $textWidthArr[$line] += $l['w'];
+ $contentsArr[] = $l;
+
+ $line === 1 && $calcSpaceRes += $calcSpace;
+ }
+
+ $calcFont = [
+ 'text_width' => max(array_values($textWidthArr)), // 取最宽行宽
+ 'text_height' => abs($fontBox[1] - $fontBox[7]),
+ ];
+ $dst_x = $this->calcTextDstX($dst_x, $calcFont);
+
+ $dst_y = $this->calcTextDstY($dst_y, $calcFont);
+
+ # 自定义间距
+ $this->fontWeightArr($draw, $weight, $fontSize, $angle, $dst_x - 5, $dst_y, $contentsArr, $color);
+
+ return true;
+
+ } else {
+ // 将字符串拆分成一个个单字 保存到数组 letter 中
+ for ($i = 0; $i < mb_strlen($content); $i++) {
+ $letter[] = mb_substr($content, $i, 1);
+ }
+
+ foreach ($letter as $l) {
+ $textStr = $contents . $l;
+ $fontBox = $this->im->queryFontMetrics($draw, $textStr);
+ $textWidth = abs($fontBox['textWidth'] + $fontBox['descender']) + $calcSpaceRes;
+ // 判断拼接后的字符串是否超过预设的宽度
+ if (($textWidth > $max_ws) && ($contents !== '')) {
+ $contents .= "\n";
+ $line++;
+ }
+ $contents .= $l;
+ $line === 1 && $calcSpaceRes += $calcSpace;
+ }
+
+ $calcFont = [
+ 'text_width' => $textWidth,
+ 'text_height' => abs($fontBox['textHeight'] + $fontBox['descender']),
+ ];
+ $dst_x = $this->calcTextDstX($dst_x, $calcFont) - $fontBox['descender']; // 调整和 gd 的误差值
+
+ $dst_y = $this->calcTextDstY($dst_y, $calcFont);
+
+ # 自定义间距
+ if ($space > 0) {
+ $dst_x_old = $dst_x;
+ for ($j = 0; $j < mb_strlen($contents); $j++) {
+ $spaceStr = mb_substr($contents, $j, 1);
+ if ($spaceStr == "\n") {
+ $dst_x = $dst_x_old;
+ $dst_y += 1.75 * $fontSize;
+ continue;
+ }
+ $this->fontWeight($draw, $weight, $fontSize, $angle, $dst_x - 5, $dst_y, $spaceStr);
+ $dst_x += $space;
+ }
+
+ } else {
+ $this->fontWeight($draw, $weight, $fontSize, $angle, $dst_x - 5, $dst_y, $contents);
+ }
+ }
+ }
+
+ public function CopyLine($x1 = 0, $y1 = 0, $x2 = 0, $y2 = 0, $rgba = [], $type = '', $weight = 1)
+ {
+ $color = $this->createColorAlpha($rgba);
+ $draw = $this->createImagickDraw();
+ $draw->setStrokeColor($color);
+ $draw->setStrokeWidth($weight);
+ switch ($type) {
+ case 'rectangle':
+ $draw->setFillColor($this->createColorAlpha());
+ $draw->rectangle($x1, $y1, $x2, $y2);
+ break;
+ case 'filled_rectangle':
+ case 'filledRectangle':
+ $draw->rectangle($x1, $y1, $x2, $y2);
+ break;
+ default:
+ $draw->line($x1, $y1, $x2, $y2);
+ break;
+ }
+
+ if ($this->type == 'gif') {
+ // 每帧长宽不一致问题, 水印会不一致
+ foreach ($this->im as $frame) {
+ $frame->drawImage($draw);
+ }
+ } else {
+ $this->im->drawImage($draw);
+ }
+ }
+
+ public function CopyArc(
+ $cx = 0,
+ $cy = 0,
+ $w = 0,
+ $h = 0,
+ $s = 0,
+ $e = 0,
+ $rgba = [],
+ $type = '',
+ $style = '',
+ $weight = 1
+ ) {
+ $color = $this->createColorAlpha($rgba);
+ $draw = $this->createImagickDraw();
+ $draw->setStrokeColor($color);
+ $draw->setStrokeWidth($weight);
+ $wr = $w / 2;
+ $hr = $h / 2;
+ switch ($type) {
+ case 'filled_arc':
+ case 'filledArc':
+ $draw->arc($cx - $wr, $cy - $hr, $cx + $wr, $cy + $hr, $s, $e);
+ break;
+ default:
+ $draw->setFillColor($this->createColorAlpha());
+ $draw->arc($cx - $wr, $cy - $hr, $cx + $wr, $cy + $hr, $s, $e);
+ break;
+ }
+ if ($this->type == 'gif') {
+ // 每帧长宽不一致问题, 水印会不一致
+ foreach ($this->im as $frame) {
+ $frame->drawImage($draw);
+ }
+ } else {
+ $this->im->drawImage($draw);
+ }
+ }
+
+ public function CopyQr(
+ $text,
+ $level = 'L',
+ $size = 4,
+ $margin = 1,
+ $dst_x = 0,
+ $dst_y = 0,
+ $src_x = 0,
+ $src_y = 0,
+ $src_w = 0,
+ $src_h = 0
+ ) {
+ if (empty($this->im)) {
+ throw new PosterException('im resources not be found');
+ }
+
+ $qr = \QRcode::re_png($text, $level, $size, $margin);
+
+ $bgWidth = imagesx($qr);
+ $bgHeight = imagesy($qr);
+
+ ob_start(); // 打开一个输出缓冲区
+ $this->poster_type['png']($qr); // 将 GD 图像输出到缓冲区
+ $imageData = ob_get_contents(); // 从缓冲区中读取图像数据
+ ob_end_clean();
+
+ $pic = $this->createImagick();
+ $pic->readImageBlob($imageData);
+
+ if ($src_w > 0) {
+ $bgWidth = $src_w;
+ }
+
+ if ($src_h > 0) {
+ $bgHeight = $src_h;
+ }
+
+ # 处理目标 x 轴
+ $dst_x = $this->calcDstX($dst_x, $this->im_w, $bgWidth);
+
+ # 处理目标 y 轴
+ $dst_y = $this->calcDstY($dst_y, $this->im_h, $bgHeight);
+
+ # 自定义宽高的时候
+ if (!empty($src_w) && !empty($src_h)) {
+ $pic->resizeImage($bgWidth, $bgHeight, $pic::FILTER_LANCZOS, 1, true);
+ }
+
+ // 裁剪图片
+ $this->cropImage($pic, $src_x, $src_y);
+ // 合并图片
+ if ($this->type == 'gif') {
+ // 每帧长宽不一致问题, 水印会不一致
+ foreach ($this->im as $frame) {
+ $frame->compositeImage($pic, ($this->im)::COMPOSITE_DEFAULT, $dst_x, $dst_y);
+ }
+ } else {
+ $this->im->compositeImage($pic, ($this->im)::COMPOSITE_DEFAULT, $dst_x, $dst_y);
+ }
+
+ !is_resource($qr) || imagedestroy($qr);
+ $this->destroyImage($pic);
+ }
+
+ /**
+ * 裁剪
+ * Author: lang
+ * Date: 2024/3/12
+ * Time: 11:22
+ * @param $x
+ * @param $y
+ * @param $width
+ * @param $height
+ */
+ public function crop($x = 0, $y = 0, $width = 0, $height = 0)
+ {
+ $this->im->cropImage($width, $height, $x, $y);
+ $this->im_w = $width;
+ $this->im_h = $height;
+ }
+
+ public function execute($query = [], Driver $driver = null)
+ {
+
+ if (empty($driver)) {
+ $driver = $this;
+ }
+ foreach ($query as $item) {
+ $driver->run($item, $driver);
+ }
+
+ return $driver;
+ }
+
+ public function destroyImage($Imagick)
+ {
+ empty($Imagick) || $Imagick->destroy();
+ }
+
+ /**
+ * 析构方法,用于销毁图像资源
+ */
+ public function __destruct()
+ {
+ empty($this->im) || $this->im->destroy();
+ empty($this->ImagickDraw) || $this->ImagickDraw->destroy();
+ }
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/Image/Extension.php b/niucloud/vendor/kkokk/poster/src/Image/Extension.php
new file mode 100644
index 000000000..6c3c21eb6
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Image/Extension.php
@@ -0,0 +1,135 @@
+driver = $driver;
+ $this->path = $path;
+ }
+
+ public function config($params = [])
+ {
+ return $this->query()->config($params);
+ }
+
+ public function buildIm($w, $h, $rgba = [], $alpha = false)
+ {
+ return $this->query()->buildIm($w, $h, $rgba, $alpha);
+ }
+
+ public function buildImDst($src, $w = 0, $h = 0)
+ {
+ return $this->query()->buildImDst($src, $w, $h);
+ }
+
+ public function buildBg($w, $h, $rgba = [], $alpha = false, $dst_x = 0, $dst_y = 0, $src_x = 0, $src_y = 0, \Closure $callback = null)
+ {
+ return $this->query()->buildBg($w, $h, $rgba, $alpha, $dst_x, $dst_y, $src_x, $src_y, $callback);
+ }
+
+ public function Qr($text, $outfile = false, $level = 'L', $size = 4, $margin = 1, $saveAndPrint = 0)
+ {
+ return $this->getDriverInstance()->createQr($text, $outfile, $level, $size, $margin, $saveAndPrint);
+ }
+
+ public function getPoster($query, $path)
+ {
+ return $this->getDriverInstance($query)->getData($path);
+ }
+
+ public function setPoster($query)
+ {
+ return $this->getDriverInstance($query)->setData();
+ }
+
+ public function stream($query)
+ {
+ return $this->getDriverInstance($query)->getStream();
+ }
+
+ public function baseData($query)
+ {
+ return $this->getDriverInstance($query)->getBaseData();
+ }
+
+ public function getIm($query)
+ {
+ return $this->getDriverInstance($query)->getIm();
+ }
+
+ public function getImInfo($query){
+ return $this->getDriverInstance($query)->getImInfo();
+ }
+
+ public function blob($query)
+ {
+ return $this->getDriverInstance($query)->blob();
+ }
+
+ public function tmp($query)
+ {
+ return $this->getDriverInstance($query)->tmp();
+ }
+
+ public function crop($x = 0, $y = 0, $width = 0, $height = 0) {
+ return $this->query()->crop($x, $y, $width, $height);
+ }
+
+ public function query()
+ {
+ return new Builder(
+ $this,
+ $this->getQueryInstance(),
+ $this->path
+ );
+ }
+
+ /**
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2023/3/24
+ * Time: 15:45
+ * @param $query
+ * @return \Kkokk\Poster\Image\Drivers\Driver
+ * @throws PosterException
+ */
+ protected function getDriverInstance($query = [])
+ {
+ return $this->run($query, function ($query) {
+ return $this->driver->execute($query);
+ });
+ }
+
+ protected function run($query, \Closure $callback)
+ {
+ try {
+ $result = $callback($query);
+ } catch (\Exception $e) {
+ throw new PosterException($e->getMessage(), 0, $e);
+ }
+
+ return $result;
+ }
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/Image/ExtensionFactory.php b/niucloud/vendor/kkokk/poster/src/Image/ExtensionFactory.php
new file mode 100644
index 000000000..31a961f20
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Image/ExtensionFactory.php
@@ -0,0 +1,49 @@
+path = $path;
+ return $this->createExtension($name);
+ }
+
+ protected function createDriver($name)
+ {
+ switch ($name) {
+ case 'gd':
+ return new GdDriver();
+ case 'imagick':
+ return new ImagickDriver();
+ }
+
+ throw new PosterException("Unsupported driver [{$name}].");
+ }
+
+ protected function createExtension($name)
+ {
+ switch ($name) {
+ case 'gd':
+ return new GdExtension($this->createDriver($name), $this->path);
+ case 'imagick':
+ return new ImagickExtension($this->createDriver($name), $this->path);
+ }
+
+ throw new PosterException("Unsupported extension [{$name}].");
+ }
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/Image/ExtensionInterface.php b/niucloud/vendor/kkokk/poster/src/Image/ExtensionInterface.php
new file mode 100644
index 000000000..d418f4caa
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Image/ExtensionInterface.php
@@ -0,0 +1,184 @@
+path = $path;
+ $this->factory = new ExtensionFactory;
+ }
+
+ public function extension($name = null)
+ {
+ $name = $this->parseConnectionName($name);
+
+ if (!isset($this->extensions[$name])) {
+ $this->extensions[$name] = $this->configure($this->makeExtension($name));
+ }
+
+ return $this->extensions[$name];
+ }
+
+ protected function configure(Extension $extension)
+ {
+ return $extension;
+ }
+
+ protected function parseConnectionName($name)
+ {
+ if (empty($name)) return $this->supportedExtensions()[0];
+ return $name;
+ }
+
+ /**
+ * 创建一个拓展实例
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2023/3/22
+ * Time: 13:58
+ * @param $name
+ */
+ protected function makeExtension($name)
+ {
+ return $this->factory->make($name, $this->path);
+ }
+
+ /**
+ * 获取所有支持拓展。
+ *
+ * @return array
+ */
+ public function supportedExtensions()
+ {
+ return ['gd', 'imagick'];
+ }
+
+ /**
+ * 将方法动态传递给默认拓展。
+ *
+ * @param string $method
+ * @param array $parameters
+ * @return mixed
+ */
+ public function __call($method, $parameters)
+ {
+ return $this->extension()->$method(...$parameters);
+ }
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/Image/Queries/GdQuery.php b/niucloud/vendor/kkokk/poster/src/Image/Queries/GdQuery.php
new file mode 100644
index 000000000..0792a9758
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Image/Queries/GdQuery.php
@@ -0,0 +1,15 @@
+query = [];
+ }
+
+ public function getQuery()
+ {
+ return $this->query;
+ }
+
+ public function setQuery($type, $params)
+ {
+ $this->query[] = ['type' => $type, 'params' => $params];
+ }
+
+ public function setPath($path)
+ {
+ $this->query[] = ['type' => 'path', 'params' => $path];
+ }
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/Image/Traits/GdTrait.php b/niucloud/vendor/kkokk/poster/src/Image/Traits/GdTrait.php
new file mode 100644
index 000000000..4808cbfd3
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Image/Traits/GdTrait.php
@@ -0,0 +1,768 @@
+im) || empty($this->im)) throw new PosterException('没有创建任何资源');
+ if ($outfile) {
+ $this->dirExists($this->pathname);
+ if (strripos($this->filename, '.') === false) {
+ $this->filename = $this->filename . '.' . $this->type;
+ }
+
+ $this->poster_type[$type]($this->im, $this->path . $this->pathname . DIRECTORY_SEPARATOR . $this->filename);
+
+ return ['url' => $this->pathname . DIRECTORY_SEPARATOR . $this->filename];
+ }
+ if(PHP_SAPI === 'cli') {
+ return $this->getBlob($type, $this->im);
+ }
+
+ header('Content-Type:Image/' . $this->type);
+ $this->poster_type[$type]($this->im);
+ }
+
+ protected function getBlob($type, $im)
+ {
+ ob_start();
+ $this->poster_type[$type]($im);
+ return ob_get_clean();
+ }
+
+ protected function getTmp($type, $im){
+ $output = tempnam(sys_get_temp_dir(), uniqid('gdImage'));
+ $this->poster_type[$type]($im, $output);
+ return $output;
+ }
+
+ protected function setImage($source)
+ {
+
+ if (strpos($source, 'http') === 0) {
+ throw new PosterException("unable to set the remote source {$source}");
+ }
+
+ if (!empty($source)) {
+ return $this->poster_type[$this->type]($this->im, $source);
+ }
+
+ throw new PosterException("source not found {$source}");
+ }
+
+ public function createImage($src = '')
+ {
+ if($src instanceof DriverInterface) {
+ return $this->returnImageInfoByBlob($src->getImageBlob());
+ } elseif(strpos($src, 'http') === 0 || file_exists($src)) {
+ return $this->returnImageInfoBySrc($src);
+ } else {
+ return $this->returnImageInfoByBlob($src);
+ }
+ }
+
+ public function returnImageInfoByBlob($blob)
+ {
+ list($width, $height) = @getimagesizefromstring($blob);
+ $pic = imagecreatefromstring($blob);
+ return [$pic, $width, $height];
+ }
+
+ public function returnImageInfoBySrc($src)
+ {
+ list($width, $height, $bgType) = @getimagesize($src);
+
+ if (empty($bgType)) throw new PosterException('image resources cannot be empty (' . $src . ')');
+
+ $bgType = image_type_to_extension($bgType, false);
+
+ $getGdVersion = preg_match('~\((.*) ~', gd_info()['GD Version'], $matches);
+ if ($getGdVersion && (float)$matches[1] < 2 && $bgType == 'gif') {
+ $pic = imagecreatefromstring(file_get_contents($src));
+ } else {
+ $fun = 'imagecreatefrom' . $bgType;
+ $pic = @$fun($src);
+ }
+
+ return [$pic, $width, $height];
+ }
+
+ /**
+ * 创建画布
+ */
+ public function createIm($w, $h, $rgba, $alpha = false)
+ {
+ $cut = imagecreatetruecolor($w, $h);
+
+ $color = $alpha ? $this->createColorAlpha($cut, $rgba) : $this->createColor($cut, $rgba);
+ if ($alpha) {
+ // imagecolortransparent($cut, $color);
+ imagesavealpha($cut, true);
+ }
+ imagefill($cut, 0, 0, $color);
+
+ return $cut;
+ }
+
+ /**
+ * 获取颜色值,可设置透明度
+ */
+ public function createColorAlpha($cut, $rgba = [255, 255, 255, 127])
+ {
+
+ if (empty($rgba)) $rgba = [255, 255, 255, 127];
+ if (count($rgba) != 4) throw new PosterException('The length of the rgba parameter is 4');
+ foreach ($rgba as $k => $value) {
+ if (!is_int($rgba[$k])) {
+ throw new PosterException('The value must be an integer');
+ } elseif ($k < 3 && ($rgba[$k] > 255 || $rgba[$k] < 0)) {
+ throw new PosterException('The color value is between 0-255');
+ } elseif ($k == 3 && ($rgba[$k] > 127 || $rgba[$k] < 0)) {
+ throw new PosterException('The alpha value is between 0-127');
+ }
+ }
+
+ return imagecolorallocatealpha($cut, $rgba[0], $rgba[1], $rgba[2], $rgba[3]);
+ }
+
+ /**
+ * 获取颜色值,没有透明度
+ */
+ public function createColor($cut, $rgba = [255, 255, 255, 1])
+ {
+
+ if (empty($rgba)) $rgba = [255, 255, 255, 1];
+ if (count($rgba) < 4) throw new PosterException('The length of the rgba parameter is 4');
+ foreach ($rgba as $k => $value) {
+ if (!is_int($rgba[$k])) {
+ throw new PosterException('The text value must be an integer');
+ } elseif ($k < 3 && ($rgba[$k] > 255 || $rgba[$k] < 0)) {
+ throw new PosterException('The text color value is between 0-255');
+ }
+ }
+
+ return imagecolorallocate($cut, $rgba[0], $rgba[1], $rgba[2]);
+ }
+
+ /**
+ * 计算渐变颜色值
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2022/10/18
+ * Time: 16:08
+ * @param $h
+ * @param $i
+ * @param $c1
+ * @param $c2
+ * @return array
+ */
+ protected function calcColor($h, $i, $c1, $c2)
+ {
+ $res = [];
+ $r = abs($c2[0] - $c1[0]);
+ $rr = $c2[0] - $c1[0];
+ $b = abs($c2[1] - $c1[1]);
+ $bb = $c2[1] - $c1[1];
+ $g = abs($c2[2] - $c1[2]);
+ $gg = $c2[2] - $c1[2];
+
+ if ($r == 0) {
+ $res[] = $c2[0];
+ } else {
+ $res[] = $rr > 0 ? ($c1[0] + $r / $h * $i) : ($c1[0] - $r / $h * $i);
+ }
+
+ if ($b == 0) {
+ $res[] = $c2[1];
+ } else {
+ $res[] = $bb > 0 ? ($c1[1] + $b / $h * $i) : ($c1[1] - $b / $h * $i);
+ }
+
+ if ($g == 0) {
+ $res[] = $c2[2];
+ } else {
+ $res[] = $gg > 0 ? ($c1[2] + $g / $h * $i) : ($c1[2] - $g / $h * $i);
+ }
+
+ return $res;
+ }
+
+ /**
+ * 计算颜色渐变区块->等比分配
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2022/10/18
+ * Time: 10:56
+ * @param $rgba
+ * @param $h
+ * @param $i
+ * @return array
+ */
+ protected function calcColorArea($rgbaColor, $rgbaCount, $h, $i)
+ {
+ // 单色
+ if ($rgbaCount == 1) {
+ $colorRgb = $this->calcColor($h, $i, $rgbaColor[0], $rgbaColor[0]);
+ } elseif ($rgbaCount == 2) {
+ // 两种颜色
+ $colorRgb = $this->calcColor($h, $i, $rgbaColor[0], $rgbaColor[1]);
+ } else {
+ // 多种颜色 计算距离并分配颜色
+ $rgbaCount = $rgbaCount - 1;
+ $d = ceil($h / $rgbaCount);
+ $index1 = 0;
+ $index2 = 1;
+ $di = 0;
+ for ($j = $rgbaCount; $j > 0; $j--) {
+
+ if ($i >= ceil((($j - 1) * $d)) && $i <= ceil($j * $d)) {
+ $index1 = $j - 1;
+ $index2 = $j;
+ $di = $i - (($j - 1) * $d);
+ break;
+ }
+ }
+ $colorRgb = $this->calcColor($d, $di, $rgbaColor[$index1], $rgbaColor[$index2]);
+ }
+
+ return $colorRgb;
+ }
+
+ /**
+ * 计算颜色渐变方向
+ * @Author lang
+ * @Email: 732853989@qq.com
+ * Date: 2022/10/20
+ * Time: 上午12:17
+ * @param $im
+ * @param $rgbaColor
+ * @param $rgbaCount
+ * @param $to
+ * @param $w
+ * @param $h
+ * @return mixed
+ */
+ public function calcColorDirection($im, $rgbaColor, $rgbaCount, $to, $w, $h)
+ {
+ $to = preg_replace('~\s+~', ' ', trim($to, ' '));
+
+ switch ($to) {
+ case '':
+ case 'bottom':
+ $toi = $h;
+ $toj = $w;
+ $im = $this->linearGradient($im, $toi, $toj, $rgbaColor, $rgbaCount);
+ break;
+ case 'top':
+ $toi = $h;
+ $toj = $w;
+ $rgbaColor = array_reverse($rgbaColor);
+ $im = $this->linearGradient($im, $toi, $toj, $rgbaColor, $rgbaCount);
+ break;
+ case 'left':
+ $toi = $w;
+ $toj = $h;
+ $rgbaColor = array_reverse($rgbaColor);
+ $im = $this->linearGradient($im, $toi, $toj, $rgbaColor, $rgbaCount, 'j', 'i');
+ break;
+ case 'right':
+ $toi = $w;
+ $toj = $h;
+ $im = $this->linearGradient($im, $toi, $toj, $rgbaColor, $rgbaCount, 'j', 'i');
+ break;
+ case 'right bottom':
+ case 'bottom right':
+ $toi = $w;
+ $toj = $h;
+ $rgbaColor = array_reverse($rgbaColor);
+ $im = $this->linearGradientLeftTopRightBottomDiagonal($im, $toi, $toj, $rgbaColor, $rgbaCount);
+ break;
+ case 'right top':
+ case 'top right':
+ $toi = $w;
+ $toj = $h;
+ $rgbaColor = array_reverse($rgbaColor);
+ $im = $this->linearGradientLeftTopRightBottomDiagonal($im, $toi, $toj, $rgbaColor, $rgbaCount, 0, $toj);
+ break;
+ case 'left bottom':
+ case 'bottom left':
+ $toi = $w;
+ $toj = $h;
+ $im = $this->linearGradientLeftTopRightBottomDiagonal($im, $toi, $toj, $rgbaColor, $rgbaCount, 0, $toj);
+ break;
+ case 'left top':
+ case 'top left':
+ $toi = $w;
+ $toj = $h;
+ $im = $this->linearGradientLeftTopRightBottomDiagonal($im, $toi, $toj, $rgbaColor, $rgbaCount);
+ break;
+ default:
+ // code...
+ break;
+ }
+
+ return $im;
+ }
+
+ /**
+ * 获取渐变颜色值
+ * @Author lang
+ * @Email: 732853989@qq.com
+ * Date: 2022/10/20
+ * Time: 上午12:15
+ * @param $im
+ * @param $rgbaColor
+ * @param $rgbaCount
+ * @param $length
+ * @param $i
+ * @return false|int
+ */
+ public function getColor($im, $rgbaColor, $rgbaCount, $length, $i)
+ {
+ $colorRgb = $this->calcColorArea($rgbaColor, $rgbaCount, $length, $i);
+ $color = imagecolorallocate($im, $colorRgb[0], $colorRgb[1], $colorRgb[2]);
+ return $color;
+ }
+
+ /**
+ * 获取透明颜色值
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2022/10/20
+ * Time: 9:37
+ * @param $im
+ * @param $colorRgb
+ * @param $alphas
+ * @return false|int
+ */
+ public function getAlphasColor($im, $colorRgb, $alphas)
+ {
+ $color = imagecolorallocatealpha($im, $colorRgb[0], $colorRgb[1], $colorRgb[2], $alphas);
+ return $color;
+ }
+
+ /**
+ * 渐变处理方法
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2022/10/20
+ * Time: 10:04
+ * @param $im resource 画布资源
+ * @param $toi double 宽或高
+ * @param $toj double 高或宽
+ * @param $rgbaColor array 渐变色值
+ * @param $rgbaCount int 渐变色数量
+ * @param int $radius int 圆角
+ * @param string $ii string x,y 变量取值替换
+ * @param string $jj string x,y 变量取值替换
+ * @return mixed|resource
+ */
+ protected function linearGradient($im, $toi, $toj, $rgbaColor, $rgbaCount, $ii = 'i', $jj = 'j')
+ {
+
+ for ($i = $toi; $i >= 0; $i--) {
+ // 获取颜色
+ $color = $this->getColor($im, $rgbaColor, $rgbaCount, $toi, $i);
+ // imagefilledrectangle($this->im, 0, $i, $w, 0, $color); // 填充颜色
+ // $color = ($colorRgb[0] << 16) + ($colorRgb[1] << 8) + $colorRgb[2]; // 获取颜色参数
+ for ($j = 0; $j < $toj; $j++) {
+ imagesetpixel($im, $$jj, $$ii, $color);
+ }
+
+ }
+
+ return $im;
+ }
+
+ /**
+ * 画圆角
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2022/10/20
+ * Time: 9:55
+ * @param $im resource 画布资源
+ * @param $w double 宽
+ * @param $h double 高
+ * @param $radius int 圆角
+ * @return mixed|resource
+ */
+ protected function setPixelRadius($im, $w, $h, $radius)
+ {
+ $newIm = $this->createIm($w, $h, [], true);;
+
+ $len = $w > $h ? $h / 2 : $w / 2;
+
+ list($leftTopRadius, $rightTopRadius, $leftBottomRadius, $rightBottomRadius) = $this->getRadiusType($radius, $len);
+
+ for ($x = 0; $x < $w; $x++) {
+ for ($y = 0; $y < $h; $y++) {
+ $color = imagecolorat($im, $x, $y);
+ if (($x >= $leftTopRadius || $y >= $leftTopRadius)
+ && (($x <= ($w - $rightTopRadius) || $y >= $rightTopRadius))
+ && (($x >= $leftBottomRadius || $y <= ($h - $leftBottomRadius)))
+ && (($x <= ($w - $rightBottomRadius)) || $y <= ($h - $rightBottomRadius))) {
+ //不在四角的范围内,直接画
+ imagesetpixel($newIm, $x, $y, $color);
+ } else {
+ // 上左
+ $y_x = $leftTopRadius;
+ $y_y = $leftTopRadius;
+ if (((($x - $y_x) * ($x - $y_x) + ($y - $y_y) * ($y - $y_y)) <= ($leftTopRadius * $leftTopRadius))) {
+ imagesetpixel($newIm, $x, $y, $color);
+ }
+
+ // 上右
+ $y_x = $w - $rightTopRadius;
+ $y_y = $rightTopRadius;
+ if (((($x - $y_x) * ($x - $y_x) + ($y - $y_y) * ($y - $y_y)) <= ($rightTopRadius * $rightTopRadius))) {
+ imagesetpixel($newIm, $x, $y, $color);
+ }
+
+ //下左
+ $y_x = $leftBottomRadius;
+ $y_y = $h - $leftBottomRadius;
+ if (((($x - $y_x) * ($x - $y_x) + ($y - $y_y) * ($y - $y_y)) <= ($leftBottomRadius * $leftBottomRadius))) {
+ imagesetpixel($newIm, $x, $y, $color);
+ }
+
+ //下右
+ $y_x = $w - $rightBottomRadius;
+ $y_y = $h - $rightBottomRadius;
+ if (((($x - $y_x) * ($x - $y_x) + ($y - $y_y) * ($y - $y_y)) <= ($rightBottomRadius * $rightBottomRadius))) {
+ imagesetpixel($newIm, $x, $y, $color);
+ }
+ }
+ }
+ }
+
+ return $newIm;
+ }
+
+ /**
+ * 渐变处理方法 对角 分两段循环
+ * @Author lang
+ * @Email: 732853989@qq.com
+ * Date: 2022/10/20
+ * Time: 上午12:13
+ * @param $im
+ * @param $toi
+ * @param $toj
+ * @param $rgbaColor
+ * @param $rgbaCount
+ * @param int $x
+ * @param int $y
+ * @return mixed
+ */
+ protected function linearGradientLeftTopRightBottom($im, $toi, $toj, $rgbaColor, $rgbaCount, $x = 0, $y = 0)
+ {
+
+ $toLen = $toi >= $toj ? $toi : $toj;
+
+ $len = $toi + $toj;
+
+ $ii = $len - 1;
+
+ if ($x == 0 && $y == 0) {
+ // 从 0,0 开始
+ for ($i = 0; $i < $toLen + 1; $i++) {
+ //设$i为y轴坐标
+ $f = 0;
+ $color = $this->getColor($im, $rgbaColor, $rgbaCount, $len, $ii--);
+ for ($j = 0; $j <= $i; $j++) {
+ if ($j <= $toi && ($i - $j) <= $toj) {
+ if (!$f) {
+ $x = $j;
+ $y = $i - $j;
+ $f = 1;
+ }
+ imagesetpixel($im, $j, $i - $j, $color);
+ }
+ }
+ }
+ //加入右半段
+ for ($i = $x + 1; $i <= $toi; $i++) {
+ $color = $this->getColor($im, $rgbaColor, $rgbaCount, $len, $ii--);
+ for ($j = 0; $j <= $y; $j++) {
+ if (($i + $j) <= $toi && ($y - $j) <= $toj) {
+ imagesetpixel($im, $i + $j, $y - $j, $color);
+ }
+ }
+ }
+ } else {
+ // 从 0,y 开始
+ for ($i = 0; $i < $toLen + 1; $i++) {
+ //设$i为y轴坐标
+ $f = false;
+ $color = $this->getColor($im, $rgbaColor, $rgbaCount, $len, $ii--);
+ for ($j = 0; $j <= $i; $j++) {
+ if ($j <= $toi && ($i - $j) <= $toj) {
+ if (!$f) {
+ $x = $j;
+ $y = $i - $j;
+ $f = true;
+ }
+ imagesetpixel($im, $j, $toj - ($i - $j), $color);
+ }
+ }
+ }
+
+ //加入后半段
+ for ($i = $x + 1; $i <= $toi; $i++) {
+ $color = $this->getColor($im, $rgbaColor, $rgbaCount, $len, $ii--);
+ for ($j = 0; $j <= $y; $j++) {
+ if (($i + $j) <= $toi && ($y - $j) <= $toj) {
+ imagesetpixel($im, $i + $j, $j, $color);
+ }
+ }
+ }
+ }
+
+ return $im;
+ }
+
+ /**
+ * 根据对角线长度循环
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2022/11/23
+ * Time: 11:35
+ * @param $im
+ * @param $toi
+ * @param $toj
+ * @param $rgbaColor
+ * @param $rgbaCount
+ * @param int $x
+ * @param int $y
+ * @return mixed
+ */
+ protected function linearGradientLeftTopRightBottomDiagonal($im, $toi, $toj, $rgbaColor, $rgbaCount, $x = 0, $y = 0)
+ {
+ $total = $toi + $toj + 1; // 对角线最大循环次数
+ $isRectangle = $toi != $toj; // 判断是否是长方形
+ // 获取中间位置数值
+ $centerNum = !$isRectangle ? $this->centerNumSquare($total) : $this->centerNumRectangle($toi, $toj);
+
+ $ii = $total; // 颜色计算递减数值
+
+ $toiTag = 'ii'; // 默认宽大于长
+ $tojTag = 'jj'; // 默认宽大于长
+ if ($toj > $toi) { // 长大于宽
+ $toiTag = 'jj';
+ $tojTag = 'ii';
+ }
+
+ if ($isRectangle) { // 长方形
+ for ($i = 0; $i < $total; $i++) {
+ $color = $this->getColor($im, $rgbaColor, $rgbaCount, $total, $ii--);
+ $im = $this->getPointRectangle($im, $i, $centerNum, $total, $color, $toiTag, $tojTag, $x, $y);
+ }
+ } else {
+ // 正方形
+ for ($i = 0; $i < $total; $i++) {
+ $color = $this->getColor($im, $rgbaColor, $rgbaCount, $total, $ii--);
+ $im = $this->getPointSquare($im, $i, $centerNum, $color, $x, $y);
+ }
+ }
+
+ return $im;
+ }
+
+ /**
+ * 正方形获取中间位置数值
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2022/11/23
+ * Time: 10:38
+ * @param $num
+ * @return float|int
+ */
+ protected function centerNumSquare($num)
+ {
+ return $num / 2;
+ }
+
+ /**
+ * 长方形获取中间位置数值
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2022/11/23
+ * Time: 10:39
+ * @param $x
+ * @param $y
+ * @return int
+ */
+ protected function centerNumRectangle($x, $y)
+ {
+ return $x > $y ? $y + 1 : $x + 1;
+ }
+
+ /**
+ * 长方形通过对角线循环绘画
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2022/12/12
+ * Time: 9:51
+ * @param $im
+ * @param $num
+ * @param $centerNum
+ * @param $total
+ * @param $color
+ * @param $toiTag
+ * @param $tojTag
+ * @param int $x
+ * @param int $y
+ * @return mixed
+ */
+ protected function getPointRectangle($im, $num, $centerNum, $total, $color, $toiTag, $tojTag, $x = 0, $y = 0)
+ {
+
+ $len = $total - $centerNum * 2; // 求取对角线上相交线坐标到边的最大宽度数量
+
+ $min = $centerNum; // 从第几次循环开始保持最大宽度
+ $max = $min + $len; // 到第几结束
+
+ if ($num >= $min && $num <= $max) {
+ $ii = $num - $centerNum + 1;
+ for ($jj = $centerNum - 1; $jj >= 0; $jj--) {
+ imagesetpixel($im, ceil($$toiTag), abs($y - floor($$tojTag)), $color);
+ $ii++;
+ }
+
+ } elseif ($num > $max) {
+
+ $num = $num - $centerNum;
+ $ii = $num + 1;
+ $jj = $max - $len - 1;
+ for ($i = $max; $i > $num; $i--) {
+ imagesetpixel($im, ceil($$toiTag), abs($y - floor($$tojTag)), $color);
+ $ii++;
+ $jj--;
+ }
+
+ } else {
+
+ for ($i = 0; $i <= $num; $i++) {
+ imagesetpixel($im, $i, abs($y - ($num - $i)), $color);
+ }
+
+ }
+
+ return $im;
+ }
+
+ /**
+ * 正方形通过对角线循环绘画
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2022/12/12
+ * Time: 9:52
+ * @param $im
+ * @param $num
+ * @param $centerNum
+ * @param $color
+ * @param int $x
+ * @param int $y
+ * @return mixed
+ */
+ protected function getPointSquare($im, $num, $centerNum, $color, $x = 0, $y = 0)
+ {
+ if ($num > $centerNum) {
+ $num = $num - $centerNum;
+ $ii = $num;
+ for ($i = $centerNum; $i >= $num; $i--) {
+ // $arr[] = [ceil($ii) , floor($i)];
+ imagesetpixel($im, ceil($ii), abs($y - floor($i)), $color);
+ $ii++;
+ }
+ } else {
+
+ for ($i = 0; $i <= $num; $i++) {
+ // $arr[] = [$i , $num-$i];
+ imagesetpixel($im, $i, abs($y - ($num - $i)), $color);
+ }
+ }
+ return $im;
+ }
+
+ /**
+ * 字体加粗
+ */
+ protected function fontWeight($weight, $fontSize, $angle, $dst_x, $dst_y, $color, $font, $contents)
+ {
+ for ($i = 0; $i < $weight; $i++) {
+ list($really_dst_x, $really_dst_y) = $this->calcWeight($i, $weight, $fontSize, $dst_x, $dst_y);
+ imagettftext($this->im, $fontSize, $angle, intval($really_dst_x), intval($really_dst_y), $color, $font, $contents);
+ }
+ }
+
+ /**
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2023/6/2
+ * Time: 14:26
+ */
+ protected function fontWeightArr($weight, $fontSize, $angle, $dst_x, $dst_y, $color, $font, $contentsArr)
+ {
+
+ $dst_x_old = $dst_x;
+ // $max = max(array_column($contentsArr, 'w')); // 取最大宽度
+
+ foreach ($contentsArr as $v) {
+
+ $contents = $v['value'];
+
+ if ($contents == "\n") {
+ $dst_x = $dst_x_old;
+ $dst_y += 1.75 * $fontSize;
+ continue;
+ }
+
+ $customColor = !empty($v['color']) ? $v['color'] : $color;
+
+ $this->fontWeight($weight, $fontSize, $angle, $dst_x, $dst_y, $customColor, $font, $contents);
+
+ // $dst_x += $max;
+ $dst_x += $v['w'];
+ }
+ }
+
+ /** 设置背景透明 */
+ public function setImageAlpha($pic, $w, $h, $alphas)
+ {
+
+ $mask = $this->createIm($w, $h, [], $alphas > 1);
+
+ for ($x = 0; $x < $w; $x++) {
+ for ($y = 0; $y < $h; $y++) {
+ $rgbColor = imagecolorat($pic, $x, $y);
+ $thisColor = imagecolorsforindex($pic, $rgbColor);
+ $color = $this->createColorAlpha($pic, [$thisColor['red'], $thisColor['green'], $thisColor['blue'], $alphas]);
+ imagesetpixel($mask, $x, $y, $color);
+ }
+ }
+
+ return $mask;
+ }
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/Image/Traits/ImagickTrait.php b/niucloud/vendor/kkokk/poster/src/Image/Traits/ImagickTrait.php
new file mode 100644
index 000000000..4c8667481
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Image/Traits/ImagickTrait.php
@@ -0,0 +1,400 @@
+im) || empty($this->im)) throw new PosterException('没有创建任何资源');
+ if (!empty($this->dpi)) {
+ $this->im->resampleImage($this->dpi[0], $this->dpi[1], ($this->im)::RESOLUTION_PIXELSPERINCH, 0); //设置画布的dpi
+ }
+ }
+
+ /**
+ * 返回图片流或者图片
+ * @Author lang
+ * @Date 2020-08-14T14:29:57+0800
+ * @return void|array
+ */
+ protected function returnImage($type, $outfile = true)
+ {
+ if ($outfile) {
+ $this->dirExists($this->pathname);
+ if (strripos($this->filename, '.') === false) {
+ $this->filename = $this->filename . '.' . $type;
+ }
+ if ($type == 'gif') {
+ $this->im->writeImages($this->path . $this->pathname . DIRECTORY_SEPARATOR . $this->filename, true);
+ } else {
+ $this->im->writeImage($this->path . $this->pathname . DIRECTORY_SEPARATOR . $this->filename);
+ }
+ return ['url' => $this->pathname . DIRECTORY_SEPARATOR . $this->filename];
+ }
+
+ $imageBlob = $this->im->getImageBlob();
+
+ if (PHP_SAPI === 'cli') {
+ return $imageBlob;
+ }
+
+ header('Content-Type:Image/' . $type);
+ echo $imageBlob;
+ }
+
+ protected function getBlob($im)
+ {
+ return $im->getImageBlob();
+ }
+
+ protected function getTmp($type, $im)
+ {
+ $output = tempnam(sys_get_temp_dir(), uniqid('imagickImage'));
+ if ($type == 'gif') {
+ $im->writeImages($output, true);
+ } else {
+ $im->writeImage($output);
+ }
+ return $output;
+ }
+
+ protected function setImage($source)
+ {
+
+ if (strpos($source, 'http') === 0) {
+ throw new PosterException("unable to set the remote source {$source}");
+ }
+
+ if (!empty($source)) {
+ if ($this->type == 'gif') return $this->im->writeImages($source, true);
+ return $this->im->writeImage($source);
+ }
+
+ throw new PosterException("source not found {$source}");
+ }
+
+ /**
+ * 创建文字绘画类
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2023/3/27
+ * Time: 16:58
+ * @return \ImagickDraw
+ */
+ public function createTextImagickDraw()
+ {
+ if (empty($this->ImagickDraw)) {
+ $this->ImagickDraw = new \ImagickDraw();
+ $this->ImagickDraw->settextencoding('UTF-8');
+ }
+ return $this->ImagickDraw;
+ }
+
+ public function createImagickDraw()
+ {
+ return new \ImagickDraw();
+ }
+
+ public function createImagick($src = '')
+ {
+ $Imagick = new \Imagick();
+ if ($src) {
+ if ($src instanceof DriverInterface) {
+ $Imagick->readImageBlob($src->getImageBlob());
+ } elseif (strpos($src, 'http') === 0 ) {
+ $stream = @file_get_contents($src, NULL);
+ if (empty($stream)) throw new PosterException('image resources cannot be empty (' . $src . ')');
+ $Imagick->readImageBlob($stream);
+ } elseif(file_exists($src)) {
+ $Imagick->readImage($this->getRealRoute($src));
+ } else {
+ $Imagick->readImageBlob($src);
+ }
+
+ }
+ return $Imagick;
+ }
+
+ /**
+ * 创建画布
+ */
+ public function createIm($w, $h, $rgba, $alpha = false, $type = null)
+ {
+ $color = $alpha ? $this->createColorAlpha($rgba) : $this->createColor($rgba);
+ $image = $this->createImagick();
+ $image->newImage($w, $h, $color, $type ?: $this->type);//设置画布的信息以及画布的格式
+ return $image;
+ }
+
+ /**
+ * 获取颜色值,可设置透明度
+ */
+ public function createColorAlpha($rgba = [255, 255, 255, 127])
+ {
+
+ if (empty($rgba)) $rgba = [255, 255, 255, 127];
+ if (count($rgba) != 4) throw new PosterException('The length of the rgba parameter is 4');
+ foreach ($rgba as $k => $value) {
+ if (!is_int($rgba[$k])) {
+ throw new PosterException('The value must be an integer');
+ } elseif ($k < 3 && ($rgba[$k] > 255 || $rgba[$k] < 0)) {
+ throw new PosterException('The color value is between 0-255');
+ } elseif ($k == 3 && ($rgba[$k] > 127 || $rgba[$k] < 0)) {
+ throw new PosterException('The alpha value is between 0-127');
+ }
+ }
+
+ $rgba[3] = sprintf("%.2f", (128 - $rgba[3]) / 127);
+
+ return new \ImagickPixel("rgba($rgba[0], $rgba[1], $rgba[2], $rgba[3])");
+ }
+
+ /**
+ * 获取颜色值,没有透明度
+ */
+ public function createColor($rgba = [255, 255, 255, 1])
+ {
+
+ if (empty($rgba)) $rgba = [255, 255, 255, 1];
+ if (count($rgba) < 4) throw new PosterException('The length of the rgba parameter is 4');
+ foreach ($rgba as $k => $value) {
+ if (!is_int($rgba[$k])) {
+ throw new PosterException('The text value must be an integer');
+ } elseif ($k < 3 && ($rgba[$k] > 255 || $rgba[$k] < 0)) {
+ throw new PosterException('The text color value is between 0-255');
+ }
+ }
+
+ return new \ImagickPixel("rgb($rgba[0], $rgba[1], $rgba[2])");
+ }
+
+ /**
+ * 剪裁图片并复制(复制指定坐标内容)
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2023/3/28
+ * Time: 11:44
+ * @param mixed $source 读取原图片
+ */
+ public function cropImage(\Imagick $source, $src_x, $src_y)
+ {
+ // 裁剪原图片,仅保留指定坐标的内容
+ if ($src_x > 0 || $src_y > 0) {
+ $width = $source->getImageWidth();
+ $height = $source->getImageHeight();
+ $source->cropImage($width - $src_x, $height - $src_y, $src_x, $src_y);
+ }
+
+ }
+
+ /**
+ * 渐变色,目前只支持两种颜色渐变,暂时只支持从上往下
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2023/3/28
+ * Time: 17:04
+ * @param \Imagick $source
+ * @param $rgbaColor
+ * @param $rgbaCount
+ * @param $to
+ * @param $w
+ * @param $h
+ * @throws \ImagickException
+ */
+ public function calcColorDirection(\Imagick $source, $rgbaColor, $rgbaCount, $to, $w, $h)
+ {
+
+ switch ($to) {
+ case '':
+ case 'bottom':
+ break;
+ case 'top':
+ $rgbaColor = array_reverse($rgbaColor);
+ break;
+ case 'left':
+ break;
+ case 'right':
+ break;
+ case 'right bottom':
+ case 'bottom right':
+ break;
+ case 'right top':
+ case 'top right':
+ break;
+ case 'left bottom':
+ case 'bottom left':
+ break;
+ case 'left top':
+ case 'top left':
+ break;
+ default:
+ // code...
+ break;
+ }
+
+ if ($rgbaCount < 3) {
+ $this->linearGradient($source, $rgbaColor, $rgbaCount, $w, $h);
+ } else {
+
+ $picKey = 0;
+ $chunk = ceil($h / ($rgbaCount - 1));
+ foreach ($rgbaColor as $k => $v) {
+
+ if ($k == $rgbaCount - 1) break;
+
+ $picsC = $this->createIm($w, $chunk, [], true);
+
+ $this->linearGradient($picsC, [$rgbaColor[$k], $rgbaColor[$k + 1]], $rgbaCount, $w, $chunk);
+
+ $source->compositeImage($picsC, ($this->im)::COMPOSITE_DEFAULT, 0, $k * $chunk);
+
+ $picKey++;
+ }
+ }
+ }
+
+ public function linearGradient(\Imagick $source, $rgbaColor, $rgbaCount, $w, $h)
+ {
+ if ($rgbaCount == 1) {
+ $rgb1 = "rgb(" . $rgbaColor[0][0] . "," . $rgbaColor[0][1] . "," . $rgbaColor[0][2] . ")";
+ $source->newPseudoImage($w, $h, "gradient:$rgb1-$rgb1");
+ } elseif ($rgbaCount > 1) {
+ $rgb1 = "rgb(" . $rgbaColor[0][0] . "," . $rgbaColor[0][1] . "," . $rgbaColor[0][2] . ")";
+ $rgb2 = "rgb(" . $rgbaColor[1][0] . "," . $rgbaColor[1][1] . "," . $rgbaColor[1][2] . ")";
+ $source->newPseudoImage($w, $h, "gradient:$rgb1-$rgb2");
+ }
+ }
+
+ protected function fontWeight($draw, $weight, $fontSize, $angle, $dst_x, $dst_y, $contents)
+ {
+ for ($i = 0; $i < $weight; $i++) {
+
+ list($really_dst_x, $really_dst_y) = $this->calcWeight($i, $weight, $fontSize, $dst_x, $dst_y);
+
+ if ($this->type == 'gif') {
+ foreach ($this->im as $frame) {
+ $frame->annotateImage($draw, $really_dst_x, $really_dst_y, $angle, $contents);
+ // $this->im->nextImage();
+ }
+ } else {
+ $this->im->annotateImage($draw, $really_dst_x, $really_dst_y, $angle, $contents);
+ }
+ }
+ }
+
+ public function fontWeightArr($draw, $weight, $fontSize, $angle, $dst_x, $dst_y, $contentsArr, $color)
+ {
+ $dst_x_old = $dst_x;
+ foreach ($contentsArr as $v) {
+
+ $contents = $v['value'];
+
+ if ($contents == "\n") {
+ $dst_x = $dst_x_old;
+ $dst_y += 1.75 * $fontSize;
+ continue;
+ }
+
+ if (!empty($v['color'])) {
+ $draw->setFillColor($v['color']);
+ } else {
+ $draw->setFillColor($color);
+ }
+
+ $this->fontWeight($draw, $weight, $fontSize, $angle, $dst_x, $dst_y, $contents);
+
+ $dst_x += $v['w'];
+ }
+ }
+
+ /**
+ * 画圆角
+ * Author: lang
+ * Email: 732853989@qq.com
+ * Date: 2023/5/19
+ * Time: 15:34
+ * @param \Imagick $pic
+ * @param $w double 宽
+ * @param $h double 高
+ * @param $radius int 圆角
+ * @return mixed
+ * @throws PosterException
+ * @throws \ImagickDrawException
+ * @throws \ImagickException
+ */
+ protected function setPixelRadius($pic, $w, $h, $radius)
+ {
+ // 圆角处理
+ $len = $w > $h ? $h / 2 : $w / 2;
+ list($leftTopRadius, $rightTopRadius, $leftBottomRadius, $rightBottomRadius) = $this->getRadiusType($radius, $len);
+ // 四个角一样
+ $mask = $this->createImagick();
+ $mask->newImage($w, $h, $this->createColorAlpha([255, 255, 255, 127]));
+ $draw = $this->createImagickDraw();
+ $draw->setFillColor($this->createColorAlpha([255, 255, 255, 1]));
+
+ if ($leftTopRadius == $rightTopRadius && $leftTopRadius == $leftBottomRadius && $leftTopRadius == $rightBottomRadius) {
+ // 搞一个长方形
+ $draw->roundRectangle(0, 0, $w, $h, $leftTopRadius, $leftTopRadius);
+ } else {
+ // 中间两个长方形填满
+ $draw->rectangle(max($leftTopRadius, $leftBottomRadius) * 2, 0, $w - max($rightTopRadius, $rightBottomRadius) * 2, $h);
+ $draw->rectangle(0, max($leftTopRadius, $rightTopRadius) * 2, $w, $h - max($leftBottomRadius, $rightBottomRadius) * 2);
+
+ // 左上角为 圆角
+ $draw->rectangle(0, $leftTopRadius, max($leftTopRadius, $leftBottomRadius) * 2, max($leftTopRadius, $rightTopRadius) * 2);
+ $draw->rectangle($leftTopRadius, 0, max($leftTopRadius, $leftBottomRadius) * 2, max($leftTopRadius, $rightTopRadius) * 2);
+ $draw->ellipse($leftTopRadius, $leftTopRadius, $leftTopRadius, $leftTopRadius, 0, 360);
+
+ // 右上角为 圆角
+ $draw->rectangle($w - max($rightTopRadius, $rightBottomRadius) * 2, 0, $w - $rightTopRadius, max($leftTopRadius, $rightTopRadius) * 2);
+ $draw->rectangle($w - max($rightTopRadius, $rightBottomRadius) * 2, $rightTopRadius, $w, max($leftTopRadius, $rightTopRadius) * 2);
+ $draw->ellipse($w - $rightTopRadius, $rightTopRadius, $rightTopRadius, $rightTopRadius, 0, 360);
+
+ // 右下角为 圆角
+ $draw->rectangle($w - max($rightBottomRadius, $rightTopRadius) * 2, $h - max($rightBottomRadius, $leftBottomRadius) * 2, $w, $h - $rightBottomRadius);
+ $draw->rectangle($w - max($rightBottomRadius, $rightTopRadius) * 2, $h - max($rightBottomRadius, $leftBottomRadius) * 2, $w - $rightBottomRadius, $h);
+ $draw->ellipse($w - $rightBottomRadius, $h - $rightBottomRadius, $rightBottomRadius, $rightBottomRadius, 0, 360);
+
+ // 左下角为 圆角
+ $draw->rectangle(0, $h - max($rightBottomRadius, $leftBottomRadius) * 2, max($leftTopRadius, $leftBottomRadius) * 2, $h - $leftBottomRadius);
+ $draw->rectangle($leftBottomRadius, $h - max($rightBottomRadius, $leftBottomRadius) * 2, max($leftTopRadius, $leftBottomRadius) * 2, $h);
+ $draw->ellipse($leftBottomRadius, $h - $leftBottomRadius, $leftBottomRadius, $leftBottomRadius, 0, 360);
+ }
+
+ $mask->drawImage($draw);
+ $pic->compositeImage($mask, ($this->im)::COMPOSITE_DSTIN, 0, 0);
+
+ return $pic;
+ }
+
+ /**
+ * 设置透明度
+ * User: lang
+ * Date: 2023/9/22
+ * Time: 11:00
+ * @param $pic
+ * @param $alphas
+ * @return void
+ */
+ protected function setImageAlpha($pic, $alphas)
+ {
+ if(method_exists($pic,'setImageOpacity')) {
+ $pic->setImageOpacity(floor((128 - $alphas) / 127 * 100) / 100); // 透明度
+ } elseif (method_exists($pic,'setImageAlpha')) {
+ $pic->setImageAlpha(floor((128 - $alphas) / 127 * 100) / 100); // 透明度
+ }
+ }
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/Lang/Captcha.php b/niucloud/vendor/kkokk/poster/src/Lang/Captcha.php
new file mode 100644
index 000000000..4d424863d
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/Lang/Captcha.php
@@ -0,0 +1,16 @@
+encode('PHP QR Code :)');
+QRspec::debug($tab, true);
+
+== TCPDF INTEGRATION ==
+
+Inside bindings/tcpdf you will find slightly modified 2dbarcodes.php.
+Instal phpqrcode liblaty inside tcpdf folder, then overwrite (or merge)
+2dbarcodes.php
+
+Then use similar as example #50 from TCPDF examples:
+
+ true,
+ 'padding' => 4,
+ 'fgcolor' => array(0,0,0),
+ 'bgcolor' => false, //array(255,255,255)
+);
+
+//code name: QR, specify error correction level after semicolon (L,M,Q,H)
+$pdf->write2DBarcode('PHP QR Code :)', 'QR,L', '', '', 30, 30, $style, 'N');
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/LICENSE b/niucloud/vendor/kkokk/poster/src/PHPQrcode/LICENSE
new file mode 100644
index 000000000..31afd6d8a
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/LICENSE
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/README b/niucloud/vendor/kkokk/poster/src/PHPQrcode/README
new file mode 100644
index 000000000..dd598f061
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/README
@@ -0,0 +1,45 @@
+This is PHP implementation of QR Code 2-D barcode generator. It is pure-php
+LGPL-licensed implementation based on C libqrencode by Kentaro Fukuchi.
+
+== LICENSING ==
+
+Copyright (C) 2010 by Dominik Dzienia
+
+This library is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free
+Software Foundation; either version 3 of the License, or any later version.
+
+This library is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+PARTICULAR PURPOSE. See the GNU Lesser General Public License (LICENSE file)
+for more details.
+
+You should have received a copy of the GNU Lesser General Public License along
+with this library; if not, write to the Free Software Foundation, Inc., 51
+Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+== INSTALATION AND USAGE ==
+
+ * INSTALL file
+ * http://sourceforge.net/apps/mediawiki/phpqrcode/index.php?title=Main_Page
+
+== CONTACT ==
+
+Fell free to contact me via e-mail (deltalab at poczta dot fm) or using
+folowing project pages:
+
+ * http://sourceforge.net/projects/phpqrcode/
+ * http://phpqrcode.sourceforge.net/
+
+== ACKNOWLEDGMENTS ==
+
+Based on C libqrencode library (ver. 3.1.1)
+Copyright (C) 2006-2010 by Kentaro Fukuchi
+http://megaui.net/fukuchi/works/qrencode/index.en.html
+
+QR Code is registered trademarks of DENSO WAVE INCORPORATED in JAPAN and other
+countries.
+
+Reed-Solomon code encoder is written by Phil Karn, KA9Q.
+Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q
+
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/VERSION b/niucloud/vendor/kkokk/poster/src/PHPQrcode/VERSION
new file mode 100644
index 000000000..2677b3628
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/VERSION
@@ -0,0 +1,2 @@
+1.1.4
+2010100721
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/bindings/tcpdf/qrcode.php b/niucloud/vendor/kkokk/poster/src/PHPQrcode/bindings/tcpdf/qrcode.php
new file mode 100644
index 000000000..4e91e8cf9
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/bindings/tcpdf/qrcode.php
@@ -0,0 +1,2877 @@
+
+// http://phpqrcode.sourceforge.net/
+// https://sourceforge.net/projects/phpqrcode/
+//
+// The "PHP QR Code encoder" is based on
+// "C libqrencode library" (ver. 3.1.1)
+// License: GNU-LGPL 2.1
+// Copyright (C) 2006-2010 by Kentaro Fukuchi
+// http://megaui.net/fukuchi/works/qrencode/index.en.html
+//
+// Reed-Solomon code encoder is written by Phil Karn, KA9Q.
+// Copyright (C) 2002-2006 Phil Karn, KA9Q
+//
+// QR Code is registered trademark of DENSO WAVE INCORPORATED
+// http://www.denso-wave.com/qrcode/index-e.html
+// ---------------------------------------------------------
+//
+// Author: Nicola Asuni
+//
+// (c) Copyright 2010:
+// Nicola Asuni
+// Tecnick.com S.r.l.
+// Via della Pace, 11
+// 09044 Quartucciu (CA)
+// ITALY
+// www.tecnick.com
+// info@tecnick.com
+//============================================================+
+
+/**
+ * Class to create QR-code arrays for TCPDF class.
+ * QR Code symbol is a 2D barcode that can be scanned by handy terminals such as a mobile phone with CCD.
+ * The capacity of QR Code is up to 7000 digits or 4000 characters, and has high robustness.
+ * This class supports QR Code model 2, described in JIS (Japanese Industrial Standards) X0510:2004 or ISO/IEC 18004.
+ * Currently the following features are not supported: ECI and FNC1 mode, Micro QR Code, QR Code model 1, Structured mode.
+ *
+ * This class is derived from "PHP QR Code encoder" by Dominik Dzienia (http://phpqrcode.sourceforge.net/) based on "libqrencode C library 3.1.1." by Kentaro Fukuchi (http://megaui.net/fukuchi/works/qrencode/index.en.html), contains Reed-Solomon code written by Phil Karn, KA9Q. QR Code is registered trademark of DENSO WAVE INCORPORATED (http://www.denso-wave.com/qrcode/index-e.html).
+ * Please read comments on this class source file for full copyright and license information.
+ *
+ * @package com.tecnick.tcpdf
+ * @abstract Class for generating QR-code array for TCPDF.
+ * @author Nicola Asuni
+ * @copyright 2010 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
+ * @link http://www.tcpdf.org
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL
+ * @version 1.0.002
+ */
+
+// definitions
+if (!defined('QRCODEDEFS')) {
+
+ /**
+ * Indicate that definitions for this class are set
+ */
+ define('QRCODEDEFS', true);
+
+ // -----------------------------------------------------
+
+ // Encoding modes (characters which can be encoded in QRcode)
+
+ /**
+ * Encoding mode
+ */
+ define('QR_MODE_NL', -1);
+
+ /**
+ * Encoding mode numeric (0-9). 3 characters are encoded to 10bit length. In theory, 7089 characters or less can be stored in a QRcode.
+ */
+ define('QR_MODE_NM', 0);
+
+ /**
+ * Encoding mode alphanumeric (0-9A-Z $%*+-./:) 45characters. 2 characters are encoded to 11bit length. In theory, 4296 characters or less can be stored in a QRcode.
+ */
+ if (!defined('QR_MODE_AN'))
+ define('QR_MODE_AN', 1);
+ }
+
+ /**
+ * Encoding mode 8bit byte data. In theory, 2953 characters or less can be stored in a QRcode.
+ */
+ define('QR_MODE_8B', 2);
+
+ /**
+ * Encoding mode KANJI. A KANJI character (multibyte character) is encoded to 13bit length. In theory, 1817 characters or less can be stored in a QRcode.
+ */
+ define('QR_MODE_KJ', 3);
+
+ /**
+ * Encoding mode STRUCTURED (currently unsupported)
+ */
+ define('QR_MODE_ST', 4);
+
+ // -----------------------------------------------------
+
+ // Levels of error correction.
+ // QRcode has a function of an error correcting for miss reading that white is black.
+ // Error correcting is defined in 4 level as below.
+
+ /**
+ * Error correction level L : About 7% or less errors can be corrected.
+ */
+ define('QR_ECLEVEL_L', 0);
+
+ /**
+ * Error correction level M : About 15% or less errors can be corrected.
+ */
+ define('QR_ECLEVEL_M', 1);
+
+ /**
+ * Error correction level Q : About 25% or less errors can be corrected.
+ */
+ define('QR_ECLEVEL_Q', 2);
+
+ /**
+ * Error correction level H : About 30% or less errors can be corrected.
+ */
+ define('QR_ECLEVEL_H', 3);
+
+ // -----------------------------------------------------
+
+ // Version. Size of QRcode is defined as version.
+ // Version is from 1 to 40.
+ // Version 1 is 21*21 matrix. And 4 modules increases whenever 1 version increases.
+ // So version 40 is 177*177 matrix.
+
+ /**
+ * Maximum QR Code version.
+ */
+ define('QRSPEC_VERSION_MAX', 40);
+
+ /**
+ * Maximum matrix size for maximum version (version 40 is 177*177 matrix).
+ */
+ define('QRSPEC_WIDTH_MAX', 177);
+
+ // -----------------------------------------------------
+
+ /**
+ * Matrix index to get width from $capacity array.
+ */
+ define('QRCAP_WIDTH', 0);
+
+ /**
+ * Matrix index to get number of words from $capacity array.
+ */
+ define('QRCAP_WORDS', 1);
+
+ /**
+ * Matrix index to get remainder from $capacity array.
+ */
+ define('QRCAP_REMINDER', 2);
+
+ /**
+ * Matrix index to get error correction level from $capacity array.
+ */
+ define('QRCAP_EC', 3);
+
+ // -----------------------------------------------------
+
+ // Structure (currently usupported)
+
+ /**
+ * Number of header bits for structured mode
+ */
+ define('STRUCTURE_HEADER_BITS', 20);
+
+ /**
+ * Max number of symbols for structured mode
+ */
+ define('MAX_STRUCTURED_SYMBOLS', 16);
+
+ // -----------------------------------------------------
+
+ // Masks
+
+ /**
+ * Down point base value for case 1 mask pattern (concatenation of same color in a line or a column)
+ */
+ define('N1', 3);
+
+ /**
+ * Down point base value for case 2 mask pattern (module block of same color)
+ */
+ define('N2', 3);
+
+ /**
+ * Down point base value for case 3 mask pattern (1:1:3:1:1(dark:bright:dark:bright:dark)pattern in a line or a column)
+ */
+ define('N3', 40);
+
+ /**
+ * Down point base value for case 4 mask pattern (ration of dark modules in whole)
+ */
+ define('N4', 10);
+
+ // -----------------------------------------------------
+
+ // Optimization settings
+
+ /**
+ * if true, estimates best mask (spec. default, but extremally slow; set to false to significant performance boost but (propably) worst quality code
+ */
+ define('QR_FIND_BEST_MASK', true);
+
+ /**
+ * if false, checks all masks available, otherwise value tells count of masks need to be checked, mask id are got randomly
+ */
+ define('QR_FIND_FROM_RANDOM', 2);
+
+ /**
+ * when QR_FIND_BEST_MASK === false
+ */
+ define('QR_DEFAULT_MASK', 2);
+
+ // -----------------------------------------------------
+
+} // end of definitions
+
+// #*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#
+
+if (!class_exists('QRcode', false)) {
+
+ // for compaibility with PHP4
+ if (!function_exists('str_split')) {
+ /**
+ * Convert a string to an array (needed for PHP4 compatibility)
+ * @param string $string The input string.
+ * @param int $split_length Maximum length of the chunk.
+ * @return If the optional split_length parameter is specified, the returned array will be broken down into chunks with each being split_length in length, otherwise each chunk will be one character in length. FALSE is returned if split_length is less than 1. If the split_length length exceeds the length of string , the entire string is returned as the first (and only) array element.
+ */
+ function str_split($string, $split_length=1) {
+ if ((strlen($string) > $split_length) OR (!$split_length)) {
+ do {
+ $c = strlen($string);
+ $parts[] = substr($string, 0, $split_length);
+ $string = substr($string, $split_length);
+ } while ($string !== false);
+ } else {
+ $parts = array($string);
+ }
+ return $parts;
+ }
+ }
+
+ // #####################################################
+
+ /**
+ * Class to create QR-code arrays for TCPDF class.
+ * QR Code symbol is a 2D barcode that can be scanned by handy terminals such as a mobile phone with CCD.
+ * The capacity of QR Code is up to 7000 digits or 4000 characters, and has high robustness.
+ * This class supports QR Code model 2, described in JIS (Japanese Industrial Standards) X0510:2004 or ISO/IEC 18004.
+ * Currently the following features are not supported: ECI and FNC1 mode, Micro QR Code, QR Code model 1, Structured mode.
+ *
+ * This class is derived from "PHP QR Code encoder" by Dominik Dzienia (http://phpqrcode.sourceforge.net/) based on "libqrencode C library 3.1.1." by Kentaro Fukuchi (http://megaui.net/fukuchi/works/qrencode/index.en.html), contains Reed-Solomon code written by Phil Karn, KA9Q. QR Code is registered trademark of DENSO WAVE INCORPORATED (http://www.denso-wave.com/qrcode/index-e.html).
+ * Please read comments on this class source file for full copyright and license information.
+ *
+ * @name QRcode
+ * @package com.tecnick.tcpdf
+ * @abstract Class for generating QR-code array for TCPDF.
+ * @author Nicola Asuni
+ * @copyright 2010 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
+ * @link http://www.tcpdf.org
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL
+ * @version 1.0.002
+ */
+ class QRcode {
+
+ /**
+ * @var barcode array to be returned which is readable by TCPDF
+ * @access protected
+ */
+ protected $barcode_array = array();
+
+ /**
+ * @var QR code version. Size of QRcode is defined as version. Version is from 1 to 40. Version 1 is 21*21 matrix. And 4 modules increases whenever 1 version increases. So version 40 is 177*177 matrix.
+ * @access protected
+ */
+ protected $version = 0;
+
+ /**
+ * @var Levels of error correction. See definitions for possible values.
+ * @access protected
+ */
+ protected $level = QR_ECLEVEL_L;
+
+ /**
+ * @var Encoding mode
+ * @access protected
+ */
+ protected $hint = QR_MODE_8B;
+
+ /**
+ * @var if true the input string will be converted to uppercase
+ * @access protected
+ */
+ protected $casesensitive = true;
+
+ /**
+ * @var structured QR code (not supported yet)
+ * @access protected
+ */
+ protected $structured = 0;
+
+ /**
+ * @var mask data
+ * @access protected
+ */
+ protected $data;
+
+ // FrameFiller
+
+ /**
+ * @var width
+ * @access protected
+ */
+ protected $width;
+
+ /**
+ * @var frame
+ * @access protected
+ */
+ protected $frame;
+
+ /**
+ * @var X position of bit
+ * @access protected
+ */
+ protected $x;
+
+ /**
+ * @var Y position of bit
+ * @access protected
+ */
+ protected $y;
+
+ /**
+ * @var direction
+ * @access protected
+ */
+ protected $dir;
+
+ /**
+ * @var single bit
+ * @access protected
+ */
+ protected $bit;
+
+ // ---- QRrawcode ----
+
+ /**
+ * @var data code
+ * @access protected
+ */
+ protected $datacode = array();
+
+ /**
+ * @var error correction code
+ * @access protected
+ */
+ protected $ecccode = array();
+
+ /**
+ * @var blocks
+ * @access protected
+ */
+ protected $blocks;
+
+ /**
+ * @var Reed-Solomon blocks
+ * @access protected
+ */
+ protected $rsblocks = array(); //of RSblock
+
+ /**
+ * @var counter
+ * @access protected
+ */
+ protected $count;
+
+ /**
+ * @var data length
+ * @access protected
+ */
+ protected $dataLength;
+
+ /**
+ * @var error correction length
+ * @access protected
+ */
+ protected $eccLength;
+
+ /**
+ * @var b1
+ * @access protected
+ */
+ protected $b1;
+
+ // ---- QRmask ----
+
+ /**
+ * @var run length
+ * @access protected
+ */
+ protected $runLength = array();
+
+ // ---- QRsplit ----
+
+ /**
+ * @var input data string
+ * @access protected
+ */
+ protected $dataStr = '';
+
+ /**
+ * @var input items
+ * @access protected
+ */
+ protected $items;
+
+ // Reed-Solomon items
+
+ /**
+ * @var Reed-Solomon items
+ * @access protected
+ */
+ protected $rsitems = array();
+
+ /**
+ * @var array of frames
+ * @access protected
+ */
+ protected $frames = array();
+
+ /**
+ * @var alphabet-numeric convesion table
+ * @access protected
+ */
+ protected $anTable = array(
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //
+ 36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43, //
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1, //
+ -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, //
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, //
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, //
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 //
+ );
+
+ /**
+ * @var array Table of the capacity of symbols
+ * See Table 1 (pp.13) and Table 12-16 (pp.30-36), JIS X0510:2004.
+ * @access protected
+ */
+ protected $capacity = array(
+ array( 0, 0, 0, array( 0, 0, 0, 0)), //
+ array( 21, 26, 0, array( 7, 10, 13, 17)), // 1
+ array( 25, 44, 7, array( 10, 16, 22, 28)), //
+ array( 29, 70, 7, array( 15, 26, 36, 44)), //
+ array( 33, 100, 7, array( 20, 36, 52, 64)), //
+ array( 37, 134, 7, array( 26, 48, 72, 88)), // 5
+ array( 41, 172, 7, array( 36, 64, 96, 112)), //
+ array( 45, 196, 0, array( 40, 72, 108, 130)), //
+ array( 49, 242, 0, array( 48, 88, 132, 156)), //
+ array( 53, 292, 0, array( 60, 110, 160, 192)), //
+ array( 57, 346, 0, array( 72, 130, 192, 224)), // 10
+ array( 61, 404, 0, array( 80, 150, 224, 264)), //
+ array( 65, 466, 0, array( 96, 176, 260, 308)), //
+ array( 69, 532, 0, array( 104, 198, 288, 352)), //
+ array( 73, 581, 3, array( 120, 216, 320, 384)), //
+ array( 77, 655, 3, array( 132, 240, 360, 432)), // 15
+ array( 81, 733, 3, array( 144, 280, 408, 480)), //
+ array( 85, 815, 3, array( 168, 308, 448, 532)), //
+ array( 89, 901, 3, array( 180, 338, 504, 588)), //
+ array( 93, 991, 3, array( 196, 364, 546, 650)), //
+ array( 97, 1085, 3, array( 224, 416, 600, 700)), // 20
+ array(101, 1156, 4, array( 224, 442, 644, 750)), //
+ array(105, 1258, 4, array( 252, 476, 690, 816)), //
+ array(109, 1364, 4, array( 270, 504, 750, 900)), //
+ array(113, 1474, 4, array( 300, 560, 810, 960)), //
+ array(117, 1588, 4, array( 312, 588, 870, 1050)), // 25
+ array(121, 1706, 4, array( 336, 644, 952, 1110)), //
+ array(125, 1828, 4, array( 360, 700, 1020, 1200)), //
+ array(129, 1921, 3, array( 390, 728, 1050, 1260)), //
+ array(133, 2051, 3, array( 420, 784, 1140, 1350)), //
+ array(137, 2185, 3, array( 450, 812, 1200, 1440)), // 30
+ array(141, 2323, 3, array( 480, 868, 1290, 1530)), //
+ array(145, 2465, 3, array( 510, 924, 1350, 1620)), //
+ array(149, 2611, 3, array( 540, 980, 1440, 1710)), //
+ array(153, 2761, 3, array( 570, 1036, 1530, 1800)), //
+ array(157, 2876, 0, array( 570, 1064, 1590, 1890)), // 35
+ array(161, 3034, 0, array( 600, 1120, 1680, 1980)), //
+ array(165, 3196, 0, array( 630, 1204, 1770, 2100)), //
+ array(169, 3362, 0, array( 660, 1260, 1860, 2220)), //
+ array(173, 3532, 0, array( 720, 1316, 1950, 2310)), //
+ array(177, 3706, 0, array( 750, 1372, 2040, 2430)) // 40
+ );
+
+ /**
+ * @var array Length indicator
+ * @access protected
+ */
+ protected $lengthTableBits = array(
+ array(10, 12, 14),
+ array( 9, 11, 13),
+ array( 8, 16, 16),
+ array( 8, 10, 12)
+ );
+
+ /**
+ * @var array Table of the error correction code (Reed-Solomon block)
+ * See Table 12-16 (pp.30-36), JIS X0510:2004.
+ * @access protected
+ */
+ protected $eccTable = array(
+ array(array( 0, 0), array( 0, 0), array( 0, 0), array( 0, 0)), //
+ array(array( 1, 0), array( 1, 0), array( 1, 0), array( 1, 0)), // 1
+ array(array( 1, 0), array( 1, 0), array( 1, 0), array( 1, 0)), //
+ array(array( 1, 0), array( 1, 0), array( 2, 0), array( 2, 0)), //
+ array(array( 1, 0), array( 2, 0), array( 2, 0), array( 4, 0)), //
+ array(array( 1, 0), array( 2, 0), array( 2, 2), array( 2, 2)), // 5
+ array(array( 2, 0), array( 4, 0), array( 4, 0), array( 4, 0)), //
+ array(array( 2, 0), array( 4, 0), array( 2, 4), array( 4, 1)), //
+ array(array( 2, 0), array( 2, 2), array( 4, 2), array( 4, 2)), //
+ array(array( 2, 0), array( 3, 2), array( 4, 4), array( 4, 4)), //
+ array(array( 2, 2), array( 4, 1), array( 6, 2), array( 6, 2)), // 10
+ array(array( 4, 0), array( 1, 4), array( 4, 4), array( 3, 8)), //
+ array(array( 2, 2), array( 6, 2), array( 4, 6), array( 7, 4)), //
+ array(array( 4, 0), array( 8, 1), array( 8, 4), array(12, 4)), //
+ array(array( 3, 1), array( 4, 5), array(11, 5), array(11, 5)), //
+ array(array( 5, 1), array( 5, 5), array( 5, 7), array(11, 7)), // 15
+ array(array( 5, 1), array( 7, 3), array(15, 2), array( 3, 13)), //
+ array(array( 1, 5), array(10, 1), array( 1, 15), array( 2, 17)), //
+ array(array( 5, 1), array( 9, 4), array(17, 1), array( 2, 19)), //
+ array(array( 3, 4), array( 3, 11), array(17, 4), array( 9, 16)), //
+ array(array( 3, 5), array( 3, 13), array(15, 5), array(15, 10)), // 20
+ array(array( 4, 4), array(17, 0), array(17, 6), array(19, 6)), //
+ array(array( 2, 7), array(17, 0), array( 7, 16), array(34, 0)), //
+ array(array( 4, 5), array( 4, 14), array(11, 14), array(16, 14)), //
+ array(array( 6, 4), array( 6, 14), array(11, 16), array(30, 2)), //
+ array(array( 8, 4), array( 8, 13), array( 7, 22), array(22, 13)), // 25
+ array(array(10, 2), array(19, 4), array(28, 6), array(33, 4)), //
+ array(array( 8, 4), array(22, 3), array( 8, 26), array(12, 28)), //
+ array(array( 3, 10), array( 3, 23), array( 4, 31), array(11, 31)), //
+ array(array( 7, 7), array(21, 7), array( 1, 37), array(19, 26)), //
+ array(array( 5, 10), array(19, 10), array(15, 25), array(23, 25)), // 30
+ array(array(13, 3), array( 2, 29), array(42, 1), array(23, 28)), //
+ array(array(17, 0), array(10, 23), array(10, 35), array(19, 35)), //
+ array(array(17, 1), array(14, 21), array(29, 19), array(11, 46)), //
+ array(array(13, 6), array(14, 23), array(44, 7), array(59, 1)), //
+ array(array(12, 7), array(12, 26), array(39, 14), array(22, 41)), // 35
+ array(array( 6, 14), array( 6, 34), array(46, 10), array( 2, 64)), //
+ array(array(17, 4), array(29, 14), array(49, 10), array(24, 46)), //
+ array(array( 4, 18), array(13, 32), array(48, 14), array(42, 32)), //
+ array(array(20, 4), array(40, 7), array(43, 22), array(10, 67)), //
+ array(array(19, 6), array(18, 31), array(34, 34), array(20, 61)) // 40
+ );
+
+ /**
+ * @var array Positions of alignment patterns.
+ * This array includes only the second and the third position of the alignment patterns. Rest of them can be calculated from the distance between them.
+ * See Table 1 in Appendix E (pp.71) of JIS X0510:2004.
+ * @access protected
+ */
+ protected $alignmentPattern = array(
+ array( 0, 0),
+ array( 0, 0), array(18, 0), array(22, 0), array(26, 0), array(30, 0), // 1- 5
+ array(34, 0), array(22, 38), array(24, 42), array(26, 46), array(28, 50), // 6-10
+ array(30, 54), array(32, 58), array(34, 62), array(26, 46), array(26, 48), // 11-15
+ array(26, 50), array(30, 54), array(30, 56), array(30, 58), array(34, 62), // 16-20
+ array(28, 50), array(26, 50), array(30, 54), array(28, 54), array(32, 58), // 21-25
+ array(30, 58), array(34, 62), array(26, 50), array(30, 54), array(26, 52), // 26-30
+ array(30, 56), array(34, 60), array(30, 58), array(34, 62), array(30, 54), // 31-35
+ array(24, 50), array(28, 54), array(32, 58), array(26, 54), array(30, 58) // 35-40
+ );
+
+ /**
+ * @var array Version information pattern (BCH coded).
+ * See Table 1 in Appendix D (pp.68) of JIS X0510:2004.
+ * size: [QRSPEC_VERSION_MAX - 6]
+ * @access protected
+ */
+ protected $versionPattern = array(
+ 0x07c94, 0x085bc, 0x09a99, 0x0a4d3, 0x0bbf6, 0x0c762, 0x0d847, 0x0e60d, //
+ 0x0f928, 0x10b78, 0x1145d, 0x12a17, 0x13532, 0x149a6, 0x15683, 0x168c9, //
+ 0x177ec, 0x18ec4, 0x191e1, 0x1afab, 0x1b08e, 0x1cc1a, 0x1d33f, 0x1ed75, //
+ 0x1f250, 0x209d5, 0x216f0, 0x228ba, 0x2379f, 0x24b0b, 0x2542e, 0x26a64, //
+ 0x27541, 0x28c69
+ );
+
+ /**
+ * @var array Format information
+ * @access protected
+ */
+ protected $formatInfo = array(
+ array(0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976), //
+ array(0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0), //
+ array(0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed), //
+ array(0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b) //
+ );
+
+
+ // -------------------------------------------------
+ // -------------------------------------------------
+
+
+ /**
+ * This is the class constructor.
+ * Creates a QRcode object
+ * @param string $code code to represent using QRcode
+ * @param string $eclevel error level: - L : About 7% or less errors can be corrected.
- M : About 15% or less errors can be corrected.
- Q : About 25% or less errors can be corrected.
- H : About 30% or less errors can be corrected.
+ * @access public
+ * @since 1.0.000
+ */
+ public function __construct($code, $eclevel = 'L') {
+ $barcode_array = array();
+ if ((is_null($code)) OR ($code == '\0') OR ($code == '')) {
+ return false;
+ }
+ // set error correction level
+ $this->level = array_search($eclevel, array('L', 'M', 'Q', 'H'));
+ if ($this->level === false) {
+ $this->level = QR_ECLEVEL_L;
+ }
+ if (($this->hint != QR_MODE_8B) AND ($this->hint != QR_MODE_KJ)) {
+ return false;
+ }
+ if (($this->version < 0) OR ($this->version > QRSPEC_VERSION_MAX)) {
+ return false;
+ }
+ $this->items = array();
+ $this->encodeString($code);
+ $qrTab = $this->binarize($this->data);
+ $size = count($qrTab);
+ $barcode_array['num_rows'] = $size;
+ $barcode_array['num_cols'] = $size;
+ $barcode_array['bcode'] = array();
+ foreach ($qrTab as $line) {
+ $arrAdd = array();
+ foreach (str_split($line) as $char) {
+ $arrAdd[] = ($char=='1')?1:0;
+ }
+ $barcode_array['bcode'][] = $arrAdd;
+ }
+ $this->barcode_array = $barcode_array;
+ }
+
+ /**
+ * Returns a barcode array which is readable by TCPDF
+ * @return array barcode array readable by TCPDF;
+ * @access public
+ */
+ public function getBarcodeArray() {
+ return $this->barcode_array;
+ }
+
+ /**
+ * Convert the frame in binary form
+ * @param array $frame array to binarize
+ * @return array frame in binary form
+ */
+ protected function binarize($frame) {
+ $len = count($frame);
+ // the frame is square (width = height)
+ foreach ($frame as &$frameLine) {
+ for ($i=0; $i<$len; $i++) {
+ $frameLine[$i] = (ord($frameLine[$i])&1)?'1':'0';
+ }
+ }
+ return $frame;
+ }
+
+ /**
+ * Encode the input string to QR code
+ * @param string $string input string to encode
+ */
+ protected function encodeString($string) {
+ $this->dataStr = $string;
+ if (!$this->casesensitive) {
+ $this->toUpper();
+ }
+ $ret = $this->splitString();
+ if ($ret < 0) {
+ return NULL;
+ }
+ $this->encodeMask(-1);
+ }
+
+ /**
+ * Encode mask
+ * @param int $mask masking mode
+ */
+ protected function encodeMask($mask) {
+ $spec = array(0, 0, 0, 0, 0);
+ $this->datacode = $this->getByteStream($this->items);
+ if (is_null($this->datacode)) {
+ return NULL;
+ }
+ $spec = $this->getEccSpec($this->version, $this->level, $spec);
+ $this->b1 = $this->rsBlockNum1($spec);
+ $this->dataLength = $this->rsDataLength($spec);
+ $this->eccLength = $this->rsEccLength($spec);
+ $this->ecccode = array_fill(0, $this->eccLength, 0);
+ $this->blocks = $this->rsBlockNum($spec);
+ $ret = $this->init($spec);
+ if ($ret < 0) {
+ return NULL;
+ }
+ $this->count = 0;
+ $this->width = $this->getWidth($this->version);
+ $this->frame = $this->newFrame($this->version);
+ $this->x = $this->width - 1;
+ $this->y = $this->width - 1;
+ $this->dir = -1;
+ $this->bit = -1;
+ // inteleaved data and ecc codes
+ for ($i=0; $i < ($this->dataLength + $this->eccLength); $i++) {
+ $code = $this->getCode();
+ $bit = 0x80;
+ for ($j=0; $j<8; $j++) {
+ $addr = $this->getNextPosition();
+ $this->setFrameAt($addr, 0x02 | (($bit & $code) != 0));
+ $bit = $bit >> 1;
+ }
+ }
+ // remainder bits
+ $j = $this->getRemainder($this->version);
+ for ($i=0; $i<$j; $i++) {
+ $addr = $this->getNextPosition();
+ $this->setFrameAt($addr, 0x02);
+ }
+ // masking
+ $this->runLength = array_fill(0, QRSPEC_WIDTH_MAX + 1, 0);
+ if ($mask < 0) {
+ if (QR_FIND_BEST_MASK) {
+ $masked = $this->mask($this->width, $this->frame, $this->level);
+ } else {
+ $masked = $this->makeMask($this->width, $this->frame, (intval(QR_DEFAULT_MASK) % 8), $this->level);
+ }
+ } else {
+ $masked = $this->makeMask($this->width, $this->frame, $mask, $this->level);
+ }
+ if ($masked == NULL) {
+ return NULL;
+ }
+ $this->data = $masked;
+ }
+
+ // - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ // FrameFiller
+
+ /**
+ * Set frame value at specified position
+ * @param array $at x,y position
+ * @param int $val value of the character to set
+ */
+ protected function setFrameAt($at, $val) {
+ $this->frame[$at['y']][$at['x']] = chr($val);
+ }
+
+ /**
+ * Get frame value at specified position
+ * @param array $at x,y position
+ * @return value at specified position
+ */
+ protected function getFrameAt($at) {
+ return ord($this->frame[$at['y']][$at['x']]);
+ }
+
+ /**
+ * Return the next frame position
+ * @return array of x,y coordinates
+ */
+ protected function getNextPosition() {
+ do {
+ if ($this->bit == -1) {
+ $this->bit = 0;
+ return array('x'=>$this->x, 'y'=>$this->y);
+ }
+ $x = $this->x;
+ $y = $this->y;
+ $w = $this->width;
+ if ($this->bit == 0) {
+ $x--;
+ $this->bit++;
+ } else {
+ $x++;
+ $y += $this->dir;
+ $this->bit--;
+ }
+ if ($this->dir < 0) {
+ if ($y < 0) {
+ $y = 0;
+ $x -= 2;
+ $this->dir = 1;
+ if ($x == 6) {
+ $x--;
+ $y = 9;
+ }
+ }
+ } else {
+ if ($y == $w) {
+ $y = $w - 1;
+ $x -= 2;
+ $this->dir = -1;
+ if ($x == 6) {
+ $x--;
+ $y -= 8;
+ }
+ }
+ }
+ if (($x < 0) OR ($y < 0)) {
+ return NULL;
+ }
+ $this->x = $x;
+ $this->y = $y;
+ } while(ord($this->frame[$y][$x]) & 0x80);
+ return array('x'=>$x, 'y'=>$y);
+ }
+
+ // - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ // QRrawcode
+
+ /**
+ * Initialize code.
+ * @param array $spec array of ECC specification
+ * @return 0 in case of success, -1 in case of error
+ */
+ protected function init($spec) {
+ $dl = $this->rsDataCodes1($spec);
+ $el = $this->rsEccCodes1($spec);
+ $rs = $this->init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el);
+ $blockNo = 0;
+ $dataPos = 0;
+ $eccPos = 0;
+ $endfor = $this->rsBlockNum1($spec);
+ for ($i=0; $i < $endfor; ++$i) {
+ $ecc = array_slice($this->ecccode, $eccPos);
+ $this->rsblocks[$blockNo] = array();
+ $this->rsblocks[$blockNo]['dataLength'] = $dl;
+ $this->rsblocks[$blockNo]['data'] = array_slice($this->datacode, $dataPos);
+ $this->rsblocks[$blockNo]['eccLength'] = $el;
+ $ecc = $this->encode_rs_char($rs, $this->rsblocks[$blockNo]['data'], $ecc);
+ $this->rsblocks[$blockNo]['ecc'] = $ecc;
+ $this->ecccode = array_merge(array_slice($this->ecccode,0, $eccPos), $ecc);
+ $dataPos += $dl;
+ $eccPos += $el;
+ $blockNo++;
+ }
+ if ($this->rsBlockNum2($spec) == 0) {
+ return 0;
+ }
+ $dl = $this->rsDataCodes2($spec);
+ $el = $this->rsEccCodes2($spec);
+ $rs = $this->init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el);
+ if ($rs == NULL) {
+ return -1;
+ }
+ $endfor = $this->rsBlockNum2($spec);
+ for ($i=0; $i < $endfor; ++$i) {
+ $ecc = array_slice($this->ecccode, $eccPos);
+ $this->rsblocks[$blockNo] = array();
+ $this->rsblocks[$blockNo]['dataLength'] = $dl;
+ $this->rsblocks[$blockNo]['data'] = array_slice($this->datacode, $dataPos);
+ $this->rsblocks[$blockNo]['eccLength'] = $el;
+ $ecc = $this->encode_rs_char($rs, $this->rsblocks[$blockNo]['data'], $ecc);
+ $this->rsblocks[$blockNo]['ecc'] = $ecc;
+ $this->ecccode = array_merge(array_slice($this->ecccode, 0, $eccPos), $ecc);
+ $dataPos += $dl;
+ $eccPos += $el;
+ $blockNo++;
+ }
+ return 0;
+ }
+
+ /**
+ * Return Reed-Solomon block code.
+ * @return array rsblocks
+ */
+ protected function getCode() {
+ if ($this->count < $this->dataLength) {
+ $row = $this->count % $this->blocks;
+ $col = $this->count / $this->blocks;
+ if ($col >= $this->rsblocks[0]['dataLength']) {
+ $row += $this->b1;
+ }
+ $ret = $this->rsblocks[$row]['data'][$col];
+ } elseif ($this->count < $this->dataLength + $this->eccLength) {
+ $row = ($this->count - $this->dataLength) % $this->blocks;
+ $col = ($this->count - $this->dataLength) / $this->blocks;
+ $ret = $this->rsblocks[$row]['ecc'][$col];
+ } else {
+ return 0;
+ }
+ $this->count++;
+ return $ret;
+ }
+
+ // - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ // QRmask
+
+ /**
+ * Write Format Information on frame and returns the number of black bits
+ * @param int $width frame width
+ * @param array $frame frame
+ * @param array $mask masking mode
+ * @param int $level error correction level
+ * @return int blacks
+ */
+ protected function writeFormatInformation($width, &$frame, $mask, $level) {
+ $blacks = 0;
+ $format = $this->getFormatInfo($mask, $level);
+ for ($i=0; $i<8; ++$i) {
+ if ($format & 1) {
+ $blacks += 2;
+ $v = 0x85;
+ } else {
+ $v = 0x84;
+ }
+ $frame[8][$width - 1 - $i] = chr($v);
+ if ($i < 6) {
+ $frame[$i][8] = chr($v);
+ } else {
+ $frame[$i + 1][8] = chr($v);
+ }
+ $format = $format >> 1;
+ }
+ for ($i=0; $i<7; ++$i) {
+ if ($format & 1) {
+ $blacks += 2;
+ $v = 0x85;
+ } else {
+ $v = 0x84;
+ }
+ $frame[$width - 7 + $i][8] = chr($v);
+ if ($i == 0) {
+ $frame[8][7] = chr($v);
+ } else {
+ $frame[8][6 - $i] = chr($v);
+ }
+ $format = $format >> 1;
+ }
+ return $blacks;
+ }
+
+ /**
+ * mask0
+ * @param int $x X position
+ * @param int $y Y position
+ * @return int mask
+ */
+ protected function mask0($x, $y) {
+ return ($x + $y) & 1;
+ }
+
+ /**
+ * mask1
+ * @param int $x X position
+ * @param int $y Y position
+ * @return int mask
+ */
+ protected function mask1($x, $y) {
+ return ($y & 1);
+ }
+
+ /**
+ * mask2
+ * @param int $x X position
+ * @param int $y Y position
+ * @return int mask
+ */
+ protected function mask2($x, $y) {
+ return ($x % 3);
+ }
+
+ /**
+ * mask3
+ * @param int $x X position
+ * @param int $y Y position
+ * @return int mask
+ */
+ protected function mask3($x, $y) {
+ return ($x + $y) % 3;
+ }
+
+ /**
+ * mask4
+ * @param int $x X position
+ * @param int $y Y position
+ * @return int mask
+ */
+ protected function mask4($x, $y) {
+ return (((int)($y / 2)) + ((int)($x / 3))) & 1;
+ }
+
+ /**
+ * mask5
+ * @param int $x X position
+ * @param int $y Y position
+ * @return int mask
+ */
+ protected function mask5($x, $y) {
+ return (($x * $y) & 1) + ($x * $y) % 3;
+ }
+
+ /**
+ * mask6
+ * @param int $x X position
+ * @param int $y Y position
+ * @return int mask
+ */
+ protected function mask6($x, $y) {
+ return ((($x * $y) & 1) + ($x * $y) % 3) & 1;
+ }
+
+ /**
+ * mask7
+ * @param int $x X position
+ * @param int $y Y position
+ * @return int mask
+ */
+ protected function mask7($x, $y) {
+ return ((($x * $y) % 3) + (($x + $y) & 1)) & 1;
+ }
+
+ /**
+ * Return bitmask
+ * @param int $maskNo mask number
+ * @param int $width width
+ * @param array $frame frame
+ * @return array bitmask
+ */
+ protected function generateMaskNo($maskNo, $width, $frame) {
+ $bitMask = array_fill(0, $width, array_fill(0, $width, 0));
+ for ($y=0; $y<$width; ++$y) {
+ for ($x=0; $x<$width; ++$x) {
+ if (ord($frame[$y][$x]) & 0x80) {
+ $bitMask[$y][$x] = 0;
+ } else {
+ $maskFunc = call_user_func(array($this, 'mask'.$maskNo), $x, $y);
+ $bitMask[$y][$x] = ($maskFunc == 0)?1:0;
+ }
+ }
+ }
+ return $bitMask;
+ }
+
+ /**
+ * makeMaskNo
+ * @param int $maskNo
+ * @param int $width
+ * @param int $s
+ * @param int $d
+ * @param boolean $maskGenOnly
+ * @return int b
+ */
+ protected function makeMaskNo($maskNo, $width, $s, &$d, $maskGenOnly=false) {
+ $b = 0;
+ $bitMask = array();
+ $bitMask = $this->generateMaskNo($maskNo, $width, $s, $d);
+ if ($maskGenOnly) {
+ return;
+ }
+ $d = $s;
+ for ($y=0; $y<$width; ++$y) {
+ for ($x=0; $x<$width; ++$x) {
+ if ($bitMask[$y][$x] == 1) {
+ $d[$y][$x] = chr(ord($s[$y][$x]) ^ (int)$bitMask[$y][$x]);
+ }
+ $b += (int)(ord($d[$y][$x]) & 1);
+ }
+ }
+ return $b;
+ }
+
+ /**
+ * makeMask
+ * @param int $width
+ * @param array $frame
+ * @param int $maskNo
+ * @param int $level
+ * @return array mask
+ */
+ protected function makeMask($width, $frame, $maskNo, $level) {
+ $masked = array_fill(0, $width, str_repeat("\0", $width));
+ $this->makeMaskNo($maskNo, $width, $frame, $masked);
+ $this->writeFormatInformation($width, $masked, $maskNo, $level);
+ return $masked;
+ }
+
+ /**
+ * calcN1N3
+ * @param int $length
+ * @return int demerit
+ */
+ protected function calcN1N3($length) {
+ $demerit = 0;
+ for ($i=0; $i<$length; ++$i) {
+ if ($this->runLength[$i] >= 5) {
+ $demerit += (N1 + ($this->runLength[$i] - 5));
+ }
+ if ($i & 1) {
+ if (($i >= 3) AND ($i < ($length-2)) AND ($this->runLength[$i] % 3 == 0)) {
+ $fact = (int)($this->runLength[$i] / 3);
+ if (($this->runLength[$i-2] == $fact)
+ AND ($this->runLength[$i-1] == $fact)
+ AND ($this->runLength[$i+1] == $fact)
+ AND ($this->runLength[$i+2] == $fact)) {
+ if (($this->runLength[$i-3] < 0) OR ($this->runLength[$i-3] >= (4 * $fact))) {
+ $demerit += N3;
+ } elseif ((($i+3) >= $length) OR ($this->runLength[$i+3] >= (4 * $fact))) {
+ $demerit += N3;
+ }
+ }
+ }
+ }
+ }
+ return $demerit;
+ }
+
+ /**
+ * evaluateSymbol
+ * @param int $width
+ * @param array $frame
+ * @return int demerit
+ */
+ protected function evaluateSymbol($width, $frame) {
+ $head = 0;
+ $demerit = 0;
+ for ($y=0; $y<$width; ++$y) {
+ $head = 0;
+ $this->runLength[0] = 1;
+ $frameY = $frame[$y];
+ if ($y > 0) {
+ $frameYM = $frame[$y-1];
+ }
+ for ($x=0; $x<$width; ++$x) {
+ if (($x > 0) AND ($y > 0)) {
+ $b22 = ord($frameY[$x]) & ord($frameY[$x-1]) & ord($frameYM[$x]) & ord($frameYM[$x-1]);
+ $w22 = ord($frameY[$x]) | ord($frameY[$x-1]) | ord($frameYM[$x]) | ord($frameYM[$x-1]);
+ if (($b22 | ($w22 ^ 1)) & 1) {
+ $demerit += N2;
+ }
+ }
+ if (($x == 0) AND (ord($frameY[$x]) & 1)) {
+ $this->runLength[0] = -1;
+ $head = 1;
+ $this->runLength[$head] = 1;
+ } elseif ($x > 0) {
+ if ((ord($frameY[$x]) ^ ord($frameY[$x-1])) & 1) {
+ $head++;
+ $this->runLength[$head] = 1;
+ } else {
+ $this->runLength[$head]++;
+ }
+ }
+ }
+ $demerit += $this->calcN1N3($head+1);
+ }
+ for ($x=0; $x<$width; ++$x) {
+ $head = 0;
+ $this->runLength[0] = 1;
+ for ($y=0; $y<$width; ++$y) {
+ if (($y == 0) AND (ord($frame[$y][$x]) & 1)) {
+ $this->runLength[0] = -1;
+ $head = 1;
+ $this->runLength[$head] = 1;
+ } elseif ($y > 0) {
+ if ((ord($frame[$y][$x]) ^ ord($frame[$y-1][$x])) & 1) {
+ $head++;
+ $this->runLength[$head] = 1;
+ } else {
+ $this->runLength[$head]++;
+ }
+ }
+ }
+ $demerit += $this->calcN1N3($head+1);
+ }
+ return $demerit;
+ }
+
+ /**
+ * mask
+ * @param int $width
+ * @param array $frame
+ * @param int $level
+ * @return array best mask
+ */
+ protected function mask($width, $frame, $level) {
+ $minDemerit = PHP_INT_MAX;
+ $bestMaskNum = 0;
+ $bestMask = array();
+ $checked_masks = array(0, 1, 2, 3, 4, 5, 6, 7);
+ if (QR_FIND_FROM_RANDOM !== false) {
+ $howManuOut = 8 - (QR_FIND_FROM_RANDOM % 9);
+ for ($i = 0; $i < $howManuOut; ++$i) {
+ $remPos = rand (0, count($checked_masks)-1);
+ unset($checked_masks[$remPos]);
+ $checked_masks = array_values($checked_masks);
+ }
+ }
+ $bestMask = $frame;
+ foreach ($checked_masks as $i) {
+ $mask = array_fill(0, $width, str_repeat("\0", $width));
+ $demerit = 0;
+ $blacks = 0;
+ $blacks = $this->makeMaskNo($i, $width, $frame, $mask);
+ $blacks += $this->writeFormatInformation($width, $mask, $i, $level);
+ $blacks = (int)(100 * $blacks / ($width * $width));
+ $demerit = (int)((int)(abs($blacks - 50) / 5) * N4);
+ $demerit += $this->evaluateSymbol($width, $mask);
+ if ($demerit < $minDemerit) {
+ $minDemerit = $demerit;
+ $bestMask = $mask;
+ $bestMaskNum = $i;
+ }
+ }
+ return $bestMask;
+ }
+
+ // - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ // QRsplit
+
+ /**
+ * Return true if the character at specified position is a number
+ * @param string $str string
+ * @param int $pos characted position
+ * @return boolean true of false
+ */
+ protected function isdigitat($str, $pos) {
+ if ($pos >= strlen($str)) {
+ return false;
+ }
+ return ((ord($str[$pos]) >= ord('0'))&&(ord($str[$pos]) <= ord('9')));
+ }
+
+ /**
+ * Return true if the character at specified position is an alphanumeric character
+ * @param string $str string
+ * @param int $pos characted position
+ * @return boolean true of false
+ */
+ protected function isalnumat($str, $pos) {
+ if ($pos >= strlen($str)) {
+ return false;
+ }
+ return ($this->lookAnTable(ord($str[$pos])) >= 0);
+ }
+
+ /**
+ * identifyMode
+ * @param int $pos
+ * @return int mode
+ */
+ protected function identifyMode($pos) {
+ if ($pos >= strlen($this->dataStr)) {
+ return QR_MODE_NL;
+ }
+ $c = $this->dataStr[$pos];
+ if ($this->isdigitat($this->dataStr, $pos)) {
+ return QR_MODE_NM;
+ } elseif ($this->isalnumat($this->dataStr, $pos)) {
+ return QR_MODE_AN;
+ } elseif ($this->hint == QR_MODE_KJ) {
+ if ($pos+1 < strlen($this->dataStr)) {
+ $d = $this->dataStr[$pos+1];
+ $word = (ord($c) << 8) | ord($d);
+ if (($word >= 0x8140 && $word <= 0x9ffc) OR ($word >= 0xe040 && $word <= 0xebbf)) {
+ return QR_MODE_KJ;
+ }
+ }
+ }
+ return QR_MODE_8B;
+ }
+
+ /**
+ * eatNum
+ * @return int run
+ */
+ protected function eatNum() {
+ $ln = $this->lengthIndicator(QR_MODE_NM, $this->version);
+ $p = 0;
+ while($this->isdigitat($this->dataStr, $p)) {
+ $p++;
+ }
+ $run = $p;
+ $mode = $this->identifyMode($p);
+ if ($mode == QR_MODE_8B) {
+ $dif = $this->estimateBitsModeNum($run) + 4 + $ln
+ + $this->estimateBitsMode8(1) // + 4 + l8
+ - $this->estimateBitsMode8($run + 1); // - 4 - l8
+ if ($dif > 0) {
+ return $this->eat8();
+ }
+ }
+ if ($mode == QR_MODE_AN) {
+ $dif = $this->estimateBitsModeNum($run) + 4 + $ln
+ + $this->estimateBitsModeAn(1) // + 4 + la
+ - $this->estimateBitsModeAn($run + 1);// - 4 - la
+ if ($dif > 0) {
+ return $this->eatAn();
+ }
+ }
+ $this->items = $this->appendNewInputItem($this->items, QR_MODE_NM, $run, str_split($this->dataStr));
+ return $run;
+ }
+
+ /**
+ * eatAn
+ * @return int run
+ */
+ protected function eatAn() {
+ $la = $this->lengthIndicator(QR_MODE_AN, $this->version);
+ $ln = $this->lengthIndicator(QR_MODE_NM, $this->version);
+ $p = 0;
+ while($this->isalnumat($this->dataStr, $p)) {
+ if ($this->isdigitat($this->dataStr, $p)) {
+ $q = $p;
+ while($this->isdigitat($this->dataStr, $q)) {
+ $q++;
+ }
+ $dif = $this->estimateBitsModeAn($p) // + 4 + la
+ + $this->estimateBitsModeNum($q - $p) + 4 + $ln
+ - $this->estimateBitsModeAn($q); // - 4 - la
+ if ($dif < 0) {
+ break;
+ } else {
+ $p = $q;
+ }
+ } else {
+ $p++;
+ }
+ }
+ $run = $p;
+ if (!$this->isalnumat($this->dataStr, $p)) {
+ $dif = $this->estimateBitsModeAn($run) + 4 + $la
+ + $this->estimateBitsMode8(1) // + 4 + l8
+ - $this->estimateBitsMode8($run + 1); // - 4 - l8
+ if ($dif > 0) {
+ return $this->eat8();
+ }
+ }
+ $this->items = $this->appendNewInputItem($this->items, QR_MODE_AN, $run, str_split($this->dataStr));
+ return $run;
+ }
+
+ /**
+ * eatKanji
+ * @return int run
+ */
+ protected function eatKanji() {
+ $p = 0;
+ while($this->identifyMode($p) == QR_MODE_KJ) {
+ $p += 2;
+ }
+ $this->items = $this->appendNewInputItem($this->items, QR_MODE_KJ, $p, str_split($this->dataStr));
+ return $run;
+ }
+
+ /**
+ * eat8
+ * @return int run
+ */
+ protected function eat8() {
+ $la = $this->lengthIndicator(QR_MODE_AN, $this->version);
+ $ln = $this->lengthIndicator(QR_MODE_NM, $this->version);
+ $p = 1;
+ $dataStrLen = strlen($this->dataStr);
+ while($p < $dataStrLen) {
+ $mode = $this->identifyMode($p);
+ if ($mode == QR_MODE_KJ) {
+ break;
+ }
+ if ($mode == QR_MODE_NM) {
+ $q = $p;
+ while($this->isdigitat($this->dataStr, $q)) {
+ $q++;
+ }
+ $dif = $this->estimateBitsMode8($p) // + 4 + l8
+ + $this->estimateBitsModeNum($q - $p) + 4 + $ln
+ - $this->estimateBitsMode8($q); // - 4 - l8
+ if ($dif < 0) {
+ break;
+ } else {
+ $p = $q;
+ }
+ } elseif ($mode == QR_MODE_AN) {
+ $q = $p;
+ while($this->isalnumat($this->dataStr, $q)) {
+ $q++;
+ }
+ $dif = $this->estimateBitsMode8($p) // + 4 + l8
+ + $this->estimateBitsModeAn($q - $p) + 4 + $la
+ - $this->estimateBitsMode8($q); // - 4 - l8
+ if ($dif < 0) {
+ break;
+ } else {
+ $p = $q;
+ }
+ } else {
+ $p++;
+ }
+ }
+ $run = $p;
+ $this->items = $this->appendNewInputItem($this->items, QR_MODE_8B, $run, str_split($this->dataStr));
+ return $run;
+ }
+
+ /**
+ * splitString
+ */
+ protected function splitString() {
+ while (strlen($this->dataStr) > 0) {
+ if ($this->dataStr == '') {
+ return 0;
+ }
+ $mode = $this->identifyMode(0);
+ switch ($mode) {
+ case QR_MODE_NM: {
+ $length = $this->eatNum();
+ break;
+ }
+ case QR_MODE_AN: {
+ $length = $this->eatAn();
+ break;
+ }
+ case QR_MODE_KJ: {
+ if ($hint == QR_MODE_KJ) {
+ $length = $this->eatKanji();
+ } else {
+ $length = $this->eat8();
+ }
+ break;
+ }
+ default: {
+ $length = $this->eat8();
+ break;
+ }
+ }
+ if ($length == 0) {
+ return 0;
+ }
+ if ($length < 0) {
+ return -1;
+ }
+ $this->dataStr = substr($this->dataStr, $length);
+ }
+ }
+
+ /**
+ * toUpper
+ */
+ protected function toUpper() {
+ $stringLen = strlen($this->dataStr);
+ $p = 0;
+ while ($p < $stringLen) {
+ $mode = $this->identifyMode(substr($this->dataStr, $p), $this->hint);
+ if ($mode == QR_MODE_KJ) {
+ $p += 2;
+ } else {
+ if ((ord($this->dataStr[$p]) >= ord('a')) AND (ord($this->dataStr[$p]) <= ord('z'))) {
+ $this->dataStr[$p] = chr(ord($this->dataStr[$p]) - 32);
+ }
+ $p++;
+ }
+ }
+ return $this->dataStr;
+ }
+
+ // - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ // QRinputItem
+
+ /**
+ * newInputItem
+ * @param int $mode
+ * @param int $size
+ * @param array $data
+ * @param array $bstream
+ * @return array input item
+ */
+ protected function newInputItem($mode, $size, $data, $bstream=null) {
+ $setData = array_slice($data, 0, $size);
+ if (count($setData) < $size) {
+ $setData = array_merge($setData, array_fill(0, ($size - count($setData)), 0));
+ }
+ if (!$this->check($mode, $size, $setData)) {
+ return NULL;
+ }
+ $inputitem = array();
+ $inputitem['mode'] = $mode;
+ $inputitem['size'] = $size;
+ $inputitem['data'] = $setData;
+ $inputitem['bstream'] = $bstream;
+ return $inputitem;
+ }
+
+ /**
+ * encodeModeNum
+ * @param array $inputitem
+ * @param int $version
+ * @return array input item
+ */
+ protected function encodeModeNum($inputitem, $version) {
+ $words = (int)($inputitem['size'] / 3);
+ $inputitem['bstream'] = array();
+ $val = 0x1;
+ $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 4, $val);
+ $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], $this->lengthIndicator(QR_MODE_NM, $version), $inputitem['size']);
+ for ($i=0; $i < $words; ++$i) {
+ $val = (ord($inputitem['data'][$i*3 ]) - ord('0')) * 100;
+ $val += (ord($inputitem['data'][$i*3+1]) - ord('0')) * 10;
+ $val += (ord($inputitem['data'][$i*3+2]) - ord('0'));
+ $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 10, $val);
+ }
+ if ($inputitem['size'] - $words * 3 == 1) {
+ $val = ord($inputitem['data'][$words*3]) - ord('0');
+ $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 4, $val);
+ } elseif (($inputitem['size'] - ($words * 3)) == 2) {
+ $val = (ord($inputitem['data'][$words*3 ]) - ord('0')) * 10;
+ $val += (ord($inputitem['data'][$words*3+1]) - ord('0'));
+ $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 7, $val);
+ }
+ return $inputitem;
+ }
+
+ /**
+ * encodeModeAn
+ * @param array $inputitem
+ * @param int $version
+ * @return array input item
+ */
+ protected function encodeModeAn($inputitem, $version) {
+ $words = (int)($inputitem['size'] / 2);
+ $inputitem['bstream'] = array();
+ $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 4, 0x02);
+ $inputitem['bstream'] = $this->appendNum(v, $this->lengthIndicator(QR_MODE_AN, $version), $inputitem['size']);
+ for ($i=0; $i < $words; ++$i) {
+ $val = (int)$this->lookAnTable(ord($inputitem['data'][$i*2 ])) * 45;
+ $val += (int)$this->lookAnTable(ord($inputitem['data'][$i*2+1]));
+ $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 11, $val);
+ }
+ if ($inputitem['size'] & 1) {
+ $val = $this->lookAnTable(ord($inputitem['data'][($words * 2)]));
+ $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 6, $val);
+ }
+ return $inputitem;
+ }
+
+ /**
+ * encodeMode8
+ * @param array $inputitem
+ * @param int $version
+ * @return array input item
+ */
+ protected function encodeMode8($inputitem, $version) {
+ $inputitem['bstream'] = array();
+ $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 4, 0x4);
+ $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], $this->lengthIndicator(QR_MODE_8B, $version), $inputitem['size']);
+ for ($i=0; $i < $inputitem['size']; ++$i) {
+ $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 8, ord($inputitem['data'][$i]));
+ }
+ return $inputitem;
+ }
+
+ /**
+ * encodeModeKanji
+ * @param array $inputitem
+ * @param int $version
+ * @return array input item
+ */
+ protected function encodeModeKanji($inputitem, $version) {
+ $inputitem['bstream'] = array();
+ $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 4, 0x8);
+ $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], $this->lengthIndicator(QR_MODE_KJ, $version), (int)($inputitem['size'] / 2));
+ for ($i=0; $i<$inputitem['size']; $i+=2) {
+ $val = (ord($inputitem['data'][$i]) << 8) | ord($inputitem['data'][$i+1]);
+ if ($val <= 0x9ffc) {
+ $val -= 0x8140;
+ } else {
+ $val -= 0xc140;
+ }
+ $h = ($val >> 8) * 0xc0;
+ $val = ($val & 0xff) + $h;
+ $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 13, $val);
+ }
+ return $inputitem;
+ }
+
+ /**
+ * encodeModeStructure
+ * @param array $inputitem
+ * @return array input item
+ */
+ protected function encodeModeStructure($inputitem) {
+ $inputitem['bstream'] = array();
+ $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 4, 0x03);
+ $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 4, ord($inputitem['data'][1]) - 1);
+ $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 4, ord($inputitem['data'][0]) - 1);
+ $inputitem['bstream'] = $this->appendNum($inputitem['bstream'], 8, ord($inputitem['data'][2]));
+ return $inputitem;
+ }
+
+ /**
+ * encodeBitStream
+ * @param array $inputitem
+ * @param int $version
+ * @return array input item
+ */
+ protected function encodeBitStream($inputitem, $version) {
+ $inputitem['bstream'] = array();
+ $words = $this->maximumWords($inputitem['mode'], $version);
+ if ($inputitem['size'] > $words) {
+ $st1 = $this->newInputItem($inputitem['mode'], $words, $inputitem['data']);
+ $st2 = $this->newInputItem($inputitem['mode'], $inputitem['size'] - $words, array_slice($inputitem['data'], $words));
+ $st1 = $this->encodeBitStream($st1, $version);
+ $st2 = $this->encodeBitStream($st2, $version);
+ $inputitem['bstream'] = array();
+ $inputitem['bstream'] = $this->appendBitstream($inputitem['bstream'], $st1['bstream']);
+ $inputitem['bstream'] = $this->appendBitstream($inputitem['bstream'], $st2['bstream']);
+ } else {
+ switch($inputitem['mode']) {
+ case QR_MODE_NM: {
+ $inputitem = $this->encodeModeNum($inputitem, $version);
+ break;
+ }
+ case QR_MODE_AN: {
+ $inputitem = $this->encodeModeAn($inputitem, $version);
+ break;
+ }
+ case QR_MODE_8B: {
+ $inputitem = $this->encodeMode8($inputitem, $version);
+ break;
+ }
+ case QR_MODE_KJ: {
+ $inputitem = $this->encodeModeKanji($inputitem, $version);
+ break;
+ }
+ case QR_MODE_ST: {
+ $inputitem = $this->encodeModeStructure($inputitem);
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ }
+ return $inputitem;
+ }
+
+ // - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ // QRinput
+
+ /**
+ * Append data to an input object.
+ * The data is copied and appended to the input object.
+ * @param array items input items
+ * @param int $mode encoding mode.
+ * @param int $size size of data (byte).
+ * @param array $data array of input data.
+ * @return items
+ *
+ */
+ protected function appendNewInputItem($items, $mode, $size, $data) {
+ $items[] = $this->newInputItem($mode, $size, $data);
+ return $items;
+ }
+
+ /**
+ * insertStructuredAppendHeader
+ * @param array $items
+ * @param int $size
+ * @param int $index
+ * @param int $parity
+ * @return array items
+ */
+ protected function insertStructuredAppendHeader($items, $size, $index, $parity) {
+ if ($size > MAX_STRUCTURED_SYMBOLS) {
+ return -1;
+ }
+ if (($index <= 0) OR ($index > MAX_STRUCTURED_SYMBOLS)) {
+ return -1;
+ }
+ $buf = array($size, $index, $parity);
+ $entry = $this->newInputItem(QR_MODE_ST, 3, buf);
+ array_unshift($items, $entry);
+ return $items;
+ }
+
+ /**
+ * calcParity
+ * @param array $items
+ * @return int parity
+ */
+ protected function calcParity($items) {
+ $parity = 0;
+ foreach ($items as $item) {
+ if ($item['mode'] != QR_MODE_ST) {
+ for ($i=$item['size']-1; $i>=0; --$i) {
+ $parity ^= $item['data'][$i];
+ }
+ }
+ }
+ return $parity;
+ }
+
+ /**
+ * checkModeNum
+ * @param int $size
+ * @param array $data
+ * @return boolean true or false
+ */
+ protected function checkModeNum($size, $data) {
+ for ($i=0; $i<$size; ++$i) {
+ if ((ord($data[$i]) < ord('0')) OR (ord($data[$i]) > ord('9'))){
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * estimateBitsModeNum
+ * @param int $size
+ * @return int number of bits
+ */
+ protected function estimateBitsModeNum($size) {
+ $w = (int)$size / 3;
+ $bits = $w * 10;
+ switch($size - $w * 3) {
+ case 1: {
+ $bits += 4;
+ break;
+ }
+ case 2: {
+ $bits += 7;
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return $bits;
+ }
+
+ /**
+ * Look up the alphabet-numeric convesion table (see JIS X0510:2004, pp.19).
+ * @param int $c character value
+ * @return value
+ */
+ protected function lookAnTable($c) {
+ return (($c > 127)?-1:$this->anTable[$c]);
+ }
+
+ /**
+ * checkModeAn
+ * @param int $size
+ * @param array $data
+ * @return boolean true or false
+ */
+ protected function checkModeAn($size, $data) {
+ for ($i=0; $i<$size; ++$i) {
+ if ($this->lookAnTable(ord($data[$i])) == -1) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * estimateBitsModeAn
+ * @param int $size
+ * @return int number of bits
+ */
+ protected function estimateBitsModeAn($size) {
+ $w = (int)($size / 2);
+ $bits = $w * 11;
+ if ($size & 1) {
+ $bits += 6;
+ }
+ return $bits;
+ }
+
+ /**
+ * estimateBitsMode8
+ * @param int $size
+ * @return int number of bits
+ */
+ protected function estimateBitsMode8($size) {
+ return $size * 8;
+ }
+
+ /**
+ * estimateBitsModeKanji
+ * @param int $size
+ * @return int number of bits
+ */
+ protected function estimateBitsModeKanji($size) {
+ return (int)(($size / 2) * 13);
+ }
+
+ /**
+ * checkModeKanji
+ * @param int $size
+ * @param array $data
+ * @return boolean true or false
+ */
+ protected function checkModeKanji($size, $data) {
+ if ($size & 1) {
+ return false;
+ }
+ for ($i=0; $i<$size; $i+=2) {
+ $val = (ord($data[$i]) << 8) | ord($data[$i+1]);
+ if (($val < 0x8140) OR (($val > 0x9ffc) AND ($val < 0xe040)) OR ($val > 0xebbf)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Validate the input data.
+ * @param int $mode encoding mode.
+ * @param int $size size of data (byte).
+ * @param array data data to validate
+ * @return boolean true in case of valid data, false otherwise
+ */
+ protected function check($mode, $size, $data) {
+ if ($size <= 0) {
+ return false;
+ }
+ switch($mode) {
+ case QR_MODE_NM: {
+ return $this->checkModeNum($size, $data);
+ }
+ case QR_MODE_AN: {
+ return $this->checkModeAn($size, $data);
+ }
+ case QR_MODE_KJ: {
+ return $this->checkModeKanji($size, $data);
+ }
+ case QR_MODE_8B: {
+ return true;
+ }
+ case QR_MODE_ST: {
+ return true;
+ }
+ default: {
+ break;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * estimateBitStreamSize
+ * @param array $items
+ * @param int $version
+ * @return int bits
+ */
+ protected function estimateBitStreamSize($items, $version) {
+ $bits = 0;
+ if ($version == 0) {
+ $version = 1;
+ }
+ foreach ($items as $item) {
+ switch($item['mode']) {
+ case QR_MODE_NM: {
+ $bits = $this->estimateBitsModeNum($item['size']);
+ break;
+ }
+ case QR_MODE_AN: {
+ $bits = $this->estimateBitsModeAn($item['size']);
+ break;
+ }
+ case QR_MODE_8B: {
+ $bits = $this->estimateBitsMode8($item['size']);
+ break;
+ }
+ case QR_MODE_KJ: {
+ $bits = $this->estimateBitsModeKanji($item['size']);
+ break;
+ }
+ case QR_MODE_ST: {
+ return STRUCTURE_HEADER_BITS;
+ }
+ default: {
+ return 0;
+ }
+ }
+ $l = $this->lengthIndicator($item['mode'], $version);
+ $m = 1 << $l;
+ $num = (int)(($item['size'] + $m - 1) / $m);
+ $bits += $num * (4 + $l);
+ }
+ return $bits;
+ }
+
+ /**
+ * estimateVersion
+ * @param array $items
+ * @return int version
+ */
+ protected function estimateVersion($items) {
+ $version = 0;
+ $prev = 0;
+ do {
+ $prev = $version;
+ $bits = $this->estimateBitStreamSize($items, $prev);
+ $version = $this->getMinimumVersion((int)(($bits + 7) / 8), $this->level);
+ if ($version < 0) {
+ return -1;
+ }
+ } while ($version > $prev);
+ return $version;
+ }
+
+ /**
+ * lengthOfCode
+ * @param int $mode
+ * @param int $version
+ * @param int $bits
+ * @return int size
+ */
+ protected function lengthOfCode($mode, $version, $bits) {
+ $payload = $bits - 4 - $this->lengthIndicator($mode, $version);
+ switch($mode) {
+ case QR_MODE_NM: {
+ $chunks = (int)($payload / 10);
+ $remain = $payload - $chunks * 10;
+ $size = $chunks * 3;
+ if ($remain >= 7) {
+ $size += 2;
+ } elseif ($remain >= 4) {
+ $size += 1;
+ }
+ break;
+ }
+ case QR_MODE_AN: {
+ $chunks = (int)($payload / 11);
+ $remain = $payload - $chunks * 11;
+ $size = $chunks * 2;
+ if ($remain >= 6) {
+ ++$size;
+ }
+ break;
+ }
+ case QR_MODE_8B: {
+ $size = (int)($payload / 8);
+ break;
+ }
+ case QR_MODE_KJ: {
+ $size = (int)(($payload / 13) * 2);
+ break;
+ }
+ case QR_MODE_ST: {
+ $size = (int)($payload / 8);
+ break;
+ }
+ default: {
+ $size = 0;
+ break;
+ }
+ }
+ $maxsize = $this->maximumWords($mode, $version);
+ if ($size < 0) {
+ $size = 0;
+ }
+ if ($size > $maxsize) {
+ $size = $maxsize;
+ }
+ return $size;
+ }
+
+ /**
+ * createBitStream
+ * @param array $items
+ * @return array of items and total bits
+ */
+ protected function createBitStream($items) {
+ $total = 0;
+ foreach ($items as $key => $item) {
+ $items[$key] = $this->encodeBitStream($item, $this->version);
+ $bits = count($items[$key]['bstream']);
+ $total += $bits;
+ }
+ return array($items, $total);
+ }
+
+ /**
+ * convertData
+ * @param array $items
+ * @return array items
+ */
+ protected function convertData($items) {
+ $ver = $this->estimateVersion($items);
+ if ($ver > $this->version) {
+ $this->version = $ver;
+ }
+ for (;;) {
+ $cbs = $this->createBitStream($items);
+ $items = $cbs[0];
+ $bits = $cbs[1];
+ if ($bits < 0) {
+ return -1;
+ }
+ $ver = $this->getMinimumVersion((int)(($bits + 7) / 8), $this->level);
+ if ($ver < 0) {
+ return -1;
+ } elseif ($ver > $this->version) {
+ $this->version = $ver;
+ } else {
+ break;
+ }
+ }
+ return $items;
+ }
+
+ /**
+ * Append Padding Bit to bitstream
+ * @param array $bstream
+ * @return array bitstream
+ */
+ protected function appendPaddingBit($bstream) {
+ $bits = count($bstream);
+ $maxwords = $this->getDataLength($this->version, $this->level);
+ $maxbits = $maxwords * 8;
+ if ($maxbits == $bits) {
+ return 0;
+ }
+ if ($maxbits - $bits < 5) {
+ return $this->appendNum($bstream, $maxbits - $bits, 0);
+ }
+ $bits += 4;
+ $words = (int)(($bits + 7) / 8);
+ $padding = array();
+ $padding = $this->appendNum($padding, $words * 8 - $bits + 4, 0);
+ $padlen = $maxwords - $words;
+ if ($padlen > 0) {
+ $padbuf = array();
+ for ($i=0; $i<$padlen; ++$i) {
+ $padbuf[$i] = ($i&1)?0x11:0xec;
+ }
+ $padding = $this->appendBytes($padding, $padlen, $padbuf);
+ }
+ return $this->appendBitstream($bstream, $padding);
+ }
+
+ /**
+ * mergeBitStream
+ * @param array $bstream
+ * @return array bitstream
+ */
+ protected function mergeBitStream($items) {
+ $items = $this->convertData($items);
+ $bstream = array();
+ foreach ($items as $item) {
+ $bstream = $this->appendBitstream($bstream, $item['bstream']);
+ }
+ return $bstream;
+ }
+
+ /**
+ * Returns a stream of bits.
+ * @param int $items
+ * @return array padded merged byte stream
+ */
+ protected function getBitStream($items) {
+ $bstream = $this->mergeBitStream($items);
+ return $this->appendPaddingBit($bstream);
+ }
+
+ /**
+ * Pack all bit streams padding bits into a byte array.
+ * @param int $items
+ * @return array padded merged byte stream
+ */
+ protected function getByteStream($items) {
+ $bstream = $this->getBitStream($items);
+ return $this->bitstreamToByte($bstream);
+ }
+
+ // - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ // QRbitstream
+
+ /**
+ * Return an array with zeros
+ * @param int $setLength array size
+ * @return array
+ */
+ protected function allocate($setLength) {
+ return array_fill(0, $setLength, 0);
+ }
+
+ /**
+ * Return new bitstream from number
+ * @param int $bits number of bits
+ * @param int $num number
+ * @return array bitstream
+ */
+ protected function newFromNum($bits, $num) {
+ $bstream = $this->allocate($bits);
+ $mask = 1 << ($bits - 1);
+ for ($i=0; $i<$bits; ++$i) {
+ if ($num & $mask) {
+ $bstream[$i] = 1;
+ } else {
+ $bstream[$i] = 0;
+ }
+ $mask = $mask >> 1;
+ }
+ return $bstream;
+ }
+
+ /**
+ * Return new bitstream from bytes
+ * @param int $size size
+ * @param array $data bytes
+ * @return array bitstream
+ */
+ protected function newFromBytes($size, $data) {
+ $bstream = $this->allocate($size * 8);
+ $p=0;
+ for ($i=0; $i<$size; ++$i) {
+ $mask = 0x80;
+ for ($j=0; $j<8; ++$j) {
+ if ($data[$i] & $mask) {
+ $bstream[$p] = 1;
+ } else {
+ $bstream[$p] = 0;
+ }
+ $p++;
+ $mask = $mask >> 1;
+ }
+ }
+ return $bstream;
+ }
+
+ /**
+ * Append one bitstream to another
+ * @param array $bitstream original bitstream
+ * @param array $append bitstream to append
+ * @return array bitstream
+ */
+ protected function appendBitstream($bitstream, $append) {
+ if ((!is_array($append)) OR (count($append) == 0)) {
+ return $bitstream;
+ }
+ if (count($bitstream) == 0) {
+ return $append;
+ }
+ return array_values(array_merge($bitstream, $append));
+ }
+
+ /**
+ * Append one bitstream created from number to another
+ * @param array $bitstream original bitstream
+ * @param int $bits number of bits
+ * @param int $num number
+ * @return array bitstream
+ */
+ protected function appendNum($bitstream, $bits, $num) {
+ if ($bits == 0) {
+ return 0;
+ }
+ $b = $this->newFromNum($bits, $num);
+ return $this->appendBitstream($bitstream, $b);
+ }
+
+ /**
+ * Append one bitstream created from bytes to another
+ * @param array $bitstream original bitstream
+ * @param int $size size
+ * @param array $data bytes
+ * @return array bitstream
+ */
+ protected function appendBytes($bitstream, $size, $data) {
+ if ($size == 0) {
+ return 0;
+ }
+ $b = $this->newFromBytes($size, $data);
+ return $this->appendBitstream($bitstream, $b);
+ }
+
+ /**
+ * Convert bitstream to bytes
+ * @param array $bitstream original bitstream
+ * @return array of bytes
+ */
+ protected function bitstreamToByte($bstream) {
+ $size = count($bstream);
+ if ($size == 0) {
+ return array();
+ }
+ $data = array_fill(0, (int)(($size + 7) / 8), 0);
+ $bytes = (int)($size / 8);
+ $p = 0;
+ for ($i=0; $i<$bytes; $i++) {
+ $v = 0;
+ for ($j=0; $j<8; $j++) {
+ $v = $v << 1;
+ $v |= $bstream[$p];
+ $p++;
+ }
+ $data[$i] = $v;
+ }
+ if ($size & 7) {
+ $v = 0;
+ for ($j=0; $j<($size & 7); $j++) {
+ $v = $v << 1;
+ $v |= $bstream[$p];
+ $p++;
+ }
+ $data[$bytes] = $v;
+ }
+ return $data;
+ }
+
+ // - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ // QRspec
+
+ /**
+ * Replace a value on the array at the specified position
+ * @param array $srctab
+ * @param int $x X position
+ * @param int $y Y position
+ * @param string $repl value to replace
+ * @param int $replLen length of the repl string
+ * @return array srctab
+ */
+ protected function qrstrset($srctab, $x, $y, $repl, $replLen=false) {
+ $srctab[$y] = substr_replace($srctab[$y], ($replLen !== false)?substr($repl,0,$replLen):$repl, $x, ($replLen !== false)?$replLen:strlen($repl));
+ return $srctab;
+ }
+
+ /**
+ * Return maximum data code length (bytes) for the version.
+ * @param int $version version
+ * @param int $level error correction level
+ * @return int maximum size (bytes)
+ */
+ protected function getDataLength($version, $level) {
+ return $this->capacity[$version][QRCAP_WORDS] - $this->capacity[$version][QRCAP_EC][$level];
+ }
+
+ /**
+ * Return maximum error correction code length (bytes) for the version.
+ * @param int $version version
+ * @param int $level error correction level
+ * @return int ECC size (bytes)
+ */
+ protected function getECCLength($version, $level){
+ return $this->capacity[$version][QRCAP_EC][$level];
+ }
+
+ /**
+ * Return the width of the symbol for the version.
+ * @param int $version version
+ * @return int width
+ */
+ protected function getWidth($version) {
+ return $this->capacity[$version][QRCAP_WIDTH];
+ }
+
+ /**
+ * Return the numer of remainder bits.
+ * @param int $version version
+ * @return int number of remainder bits
+ */
+ protected function getRemainder($version) {
+ return $this->capacity[$version][QRCAP_REMINDER];
+ }
+
+ /**
+ * Return a version number that satisfies the input code length.
+ * @param int $size input code length (byte)
+ * @param int $level error correction level
+ * @return int version number
+ */
+ protected function getMinimumVersion($size, $level) {
+ for ($i=1; $i <= QRSPEC_VERSION_MAX; ++$i) {
+ $words = $this->capacity[$i][QRCAP_WORDS] - $this->capacity[$i][QRCAP_EC][$level];
+ if ($words >= $size) {
+ return $i;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Return the size of length indicator for the mode and version.
+ * @param int $mode encoding mode
+ * @param int $version version
+ * @return int the size of the appropriate length indicator (bits).
+ */
+ protected function lengthIndicator($mode, $version) {
+ if ($mode == QR_MODE_ST) {
+ return 0;
+ }
+ if ($version <= 9) {
+ $l = 0;
+ } elseif ($version <= 26) {
+ $l = 1;
+ } else {
+ $l = 2;
+ }
+ return $this->lengthTableBits[$mode][$l];
+ }
+
+ /**
+ * Return the maximum length for the mode and version.
+ * @param int $mode encoding mode
+ * @param int $version version
+ * @return int the maximum length (bytes)
+ */
+ protected function maximumWords($mode, $version) {
+ if ($mode == QR_MODE_ST) {
+ return 3;
+ }
+ if ($version <= 9) {
+ $l = 0;
+ } else if ($version <= 26) {
+ $l = 1;
+ } else {
+ $l = 2;
+ }
+ $bits = $this->lengthTableBits[$mode][$l];
+ $words = (1 << $bits) - 1;
+ if ($mode == QR_MODE_KJ) {
+ $words *= 2; // the number of bytes is required
+ }
+ return $words;
+ }
+
+ /**
+ * Return an array of ECC specification.
+ * @param int $version version
+ * @param int $level error correction level
+ * @param array $spec an array of ECC specification contains as following: {# of type1 blocks, # of data code, # of ecc code, # of type2 blocks, # of data code}
+ * @return array spec
+ */
+ protected function getEccSpec($version, $level, $spec) {
+ if (count($spec) < 5) {
+ $spec = array(0, 0, 0, 0, 0);
+ }
+ $b1 = $this->eccTable[$version][$level][0];
+ $b2 = $this->eccTable[$version][$level][1];
+ $data = $this->getDataLength($version, $level);
+ $ecc = $this->getECCLength($version, $level);
+ if ($b2 == 0) {
+ $spec[0] = $b1;
+ $spec[1] = (int)($data / $b1);
+ $spec[2] = (int)($ecc / $b1);
+ $spec[3] = 0;
+ $spec[4] = 0;
+ } else {
+ $spec[0] = $b1;
+ $spec[1] = (int)($data / ($b1 + $b2));
+ $spec[2] = (int)($ecc / ($b1 + $b2));
+ $spec[3] = $b2;
+ $spec[4] = $spec[1] + 1;
+ }
+ return $spec;
+ }
+
+ /**
+ * Put an alignment marker.
+ * @param array $frame frame
+ * @param int $width width
+ * @param int $ox X center coordinate of the pattern
+ * @param int $oy Y center coordinate of the pattern
+ * @return array frame
+ */
+ protected function putAlignmentMarker($frame, $ox, $oy) {
+ $finder = array(
+ "\xa1\xa1\xa1\xa1\xa1",
+ "\xa1\xa0\xa0\xa0\xa1",
+ "\xa1\xa0\xa1\xa0\xa1",
+ "\xa1\xa0\xa0\xa0\xa1",
+ "\xa1\xa1\xa1\xa1\xa1"
+ );
+ $yStart = $oy - 2;
+ $xStart = $ox - 2;
+ for ($y=0; $y < 5; $y++) {
+ $frame = $this->qrstrset($frame, $xStart, $yStart+$y, $finder[$y]);
+ }
+ return $frame;
+ }
+
+ /**
+ * Put an alignment pattern.
+ * @param int $version version
+ * @param array $fram frame
+ * @param int $width width
+ * @return array frame
+ */
+ protected function putAlignmentPattern($version, $frame, $width) {
+ if ($version < 2) {
+ return $frame;
+ }
+ $d = $this->alignmentPattern[$version][1] - $this->alignmentPattern[$version][0];
+ if ($d < 0) {
+ $w = 2;
+ } else {
+ $w = (int)(($width - $this->alignmentPattern[$version][0]) / $d + 2);
+ }
+ if ($w * $w - 3 == 1) {
+ $x = $this->alignmentPattern[$version][0];
+ $y = $this->alignmentPattern[$version][0];
+ $frame = $this->putAlignmentMarker($frame, $x, $y);
+ return $frame;
+ }
+ $cx = $this->alignmentPattern[$version][0];
+ $wo = $w - 1;
+ for ($x=1; $x < $wo; ++$x) {
+ $frame = $this->putAlignmentMarker($frame, 6, $cx);
+ $frame = $this->putAlignmentMarker($frame, $cx, 6);
+ $cx += $d;
+ }
+ $cy = $this->alignmentPattern[$version][0];
+ for ($y=0; $y < $wo; ++$y) {
+ $cx = $this->alignmentPattern[$version][0];
+ for ($x=0; $x < $wo; ++$x) {
+ $frame = $this->putAlignmentMarker($frame, $cx, $cy);
+ $cx += $d;
+ }
+ $cy += $d;
+ }
+ return $frame;
+ }
+
+ /**
+ * Return BCH encoded version information pattern that is used for the symbol of version 7 or greater. Use lower 18 bits.
+ * @param int $version version
+ * @return BCH encoded version information pattern
+ */
+ protected function getVersionPattern($version) {
+ if (($version < 7) OR ($version > QRSPEC_VERSION_MAX)) {
+ return 0;
+ }
+ return $this->versionPattern[($version - 7)];
+ }
+
+ /**
+ * Return BCH encoded format information pattern.
+ * @param array $mask
+ * @param int $level error correction level
+ * @return BCH encoded format information pattern
+ */
+ protected function getFormatInfo($mask, $level) {
+ if (($mask < 0) OR ($mask > 7)) {
+ return 0;
+ }
+ if (($level < 0) OR ($level > 3)) {
+ return 0;
+ }
+ return $this->formatInfo[$level][$mask];
+ }
+
+ /**
+ * Put a finder pattern.
+ * @param array $frame frame
+ * @param int $width width
+ * @param int $ox X center coordinate of the pattern
+ * @param int $oy Y center coordinate of the pattern
+ * @return array frame
+ */
+ protected function putFinderPattern($frame, $ox, $oy) {
+ $finder = array(
+ "\xc1\xc1\xc1\xc1\xc1\xc1\xc1",
+ "\xc1\xc0\xc0\xc0\xc0\xc0\xc1",
+ "\xc1\xc0\xc1\xc1\xc1\xc0\xc1",
+ "\xc1\xc0\xc1\xc1\xc1\xc0\xc1",
+ "\xc1\xc0\xc1\xc1\xc1\xc0\xc1",
+ "\xc1\xc0\xc0\xc0\xc0\xc0\xc1",
+ "\xc1\xc1\xc1\xc1\xc1\xc1\xc1"
+ );
+ for ($y=0; $y < 7; $y++) {
+ $frame = $this->qrstrset($frame, $ox, ($oy + $y), $finder[$y]);
+ }
+ return $frame;
+ }
+
+ /**
+ * Return a copy of initialized frame.
+ * @param int $version version
+ * @return Array of unsigned char.
+ */
+ protected function createFrame($version) {
+ $width = $this->capacity[$version][QRCAP_WIDTH];
+ $frameLine = str_repeat ("\0", $width);
+ $frame = array_fill(0, $width, $frameLine);
+ // Finder pattern
+ $frame = $this->putFinderPattern($frame, 0, 0);
+ $frame = $this->putFinderPattern($frame, $width - 7, 0);
+ $frame = $this->putFinderPattern($frame, 0, $width - 7);
+ // Separator
+ $yOffset = $width - 7;
+ for ($y=0; $y < 7; ++$y) {
+ $frame[$y][7] = "\xc0";
+ $frame[$y][$width - 8] = "\xc0";
+ $frame[$yOffset][7] = "\xc0";
+ ++$yOffset;
+ }
+ $setPattern = str_repeat("\xc0", 8);
+ $frame = $this->qrstrset($frame, 0, 7, $setPattern);
+ $frame = $this->qrstrset($frame, $width-8, 7, $setPattern);
+ $frame = $this->qrstrset($frame, 0, $width - 8, $setPattern);
+ // Format info
+ $setPattern = str_repeat("\x84", 9);
+ $frame = $this->qrstrset($frame, 0, 8, $setPattern);
+ $frame = $this->qrstrset($frame, $width - 8, 8, $setPattern, 8);
+ $yOffset = $width - 8;
+ for ($y=0; $y < 8; ++$y,++$yOffset) {
+ $frame[$y][8] = "\x84";
+ $frame[$yOffset][8] = "\x84";
+ }
+ // Timing pattern
+ $wo = $width - 15;
+ for ($i=1; $i < $wo; ++$i) {
+ $frame[6][7+$i] = chr(0x90 | ($i & 1));
+ $frame[7+$i][6] = chr(0x90 | ($i & 1));
+ }
+ // Alignment pattern
+ $frame = $this->putAlignmentPattern($version, $frame, $width);
+ // Version information
+ if ($version >= 7) {
+ $vinf = $this->getVersionPattern($version);
+ $v = $vinf;
+ for ($x=0; $x<6; ++$x) {
+ for ($y=0; $y<3; ++$y) {
+ $frame[($width - 11)+$y][$x] = chr(0x88 | ($v & 1));
+ $v = $v >> 1;
+ }
+ }
+ $v = $vinf;
+ for ($y=0; $y<6; ++$y) {
+ for ($x=0; $x<3; ++$x) {
+ $frame[$y][$x+($width - 11)] = chr(0x88 | ($v & 1));
+ $v = $v >> 1;
+ }
+ }
+ }
+ // and a little bit...
+ $frame[$width - 8][8] = "\x81";
+ return $frame;
+ }
+
+ /**
+ * Set new frame for the specified version.
+ * @param int $version version
+ * @return Array of unsigned char.
+ */
+ protected function newFrame($version) {
+ if (($version < 1) OR ($version > QRSPEC_VERSION_MAX)) {
+ return NULL;
+ }
+ if (!isset($this->frames[$version])) {
+ $this->frames[$version] = $this->createFrame($version);
+ }
+ if (is_null($this->frames[$version])) {
+ return NULL;
+ }
+ return $this->frames[$version];
+ }
+
+ /**
+ * Return block number 0
+ * @param array $spec
+ * @return int value
+ */
+ protected function rsBlockNum($spec) {
+ return ($spec[0] + $spec[3]);
+ }
+
+ /**
+ * Return block number 1
+ * @param array $spec
+ * @return int value
+ */
+ protected function rsBlockNum1($spec) {
+ return $spec[0];
+ }
+
+ /**
+ * Return data codes 1
+ * @param array $spec
+ * @return int value
+ */
+ protected function rsDataCodes1($spec) {
+ return $spec[1];
+ }
+
+ /**
+ * Return ecc codes 1
+ * @param array $spec
+ * @return int value
+ */
+ protected function rsEccCodes1($spec) {
+ return $spec[2];
+ }
+
+ /**
+ * Return block number 2
+ * @param array $spec
+ * @return int value
+ */
+ protected function rsBlockNum2($spec) {
+ return $spec[3];
+ }
+
+ /**
+ * Return data codes 2
+ * @param array $spec
+ * @return int value
+ */
+ protected function rsDataCodes2($spec) {
+ return $spec[4];
+ }
+
+ /**
+ * Return ecc codes 2
+ * @param array $spec
+ * @return int value
+ */
+ protected function rsEccCodes2($spec) {
+ return $spec[2];
+ }
+
+ /**
+ * Return data length
+ * @param array $spec
+ * @return int value
+ */
+ protected function rsDataLength($spec) {
+ return ($spec[0] * $spec[1]) + ($spec[3] * $spec[4]);
+ }
+
+ /**
+ * Return ecc length
+ * @param array $spec
+ * @return int value
+ */
+ protected function rsEccLength($spec) {
+ return ($spec[0] + $spec[3]) * $spec[2];
+ }
+
+ // - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ // QRrs
+
+ /**
+ * Initialize a Reed-Solomon codec and add it to existing rsitems
+ * @param int $symsize symbol size, bits
+ * @param int $gfpoly Field generator polynomial coefficients
+ * @param int $fcr first root of RS code generator polynomial, index form
+ * @param int $prim primitive element to generate polynomial roots
+ * @param int $nroots RS code generator polynomial degree (number of roots)
+ * @param int $pad padding bytes at front of shortened block
+ * @return array Array of RS values:- mm = Bits per symbol;
- nn = Symbols per block;
- alpha_to = log lookup table array;
- index_of = Antilog lookup table array;
- genpoly = Generator polynomial array;
- nroots = Number of generator;
- roots = number of parity symbols;
- fcr = First consecutive root, index form;
- prim = Primitive element, index form;
- iprim = prim-th root of 1, index form;
- pad = Padding bytes in shortened block;
- gfpoly
.
+ */
+ protected function init_rs($symsize, $gfpoly, $fcr, $prim, $nroots, $pad) {
+ foreach ($this->rsitems as $rs) {
+ if (($rs['pad'] != $pad) OR ($rs['nroots'] != $nroots) OR ($rs['mm'] != $symsize)
+ OR ($rs['gfpoly'] != $gfpoly) OR ($rs['fcr'] != $fcr) OR ($rs['prim'] != $prim)) {
+ continue;
+ }
+ return $rs;
+ }
+ $rs = $this->init_rs_char($symsize, $gfpoly, $fcr, $prim, $nroots, $pad);
+ array_unshift($this->rsitems, $rs);
+ return $rs;
+ }
+
+ // - - - - - - - - - - - - - - - - - - - - - - - - -
+
+ // QRrsItem
+
+ /**
+ * modnn
+ * @param array RS values
+ * @param int $x X position
+ * @return int X osition
+ */
+ protected function modnn($rs, $x) {
+ while ($x >= $rs['nn']) {
+ $x -= $rs['nn'];
+ $x = ($x >> $rs['mm']) + ($x & $rs['nn']);
+ }
+ return $x;
+ }
+
+ /**
+ * Initialize a Reed-Solomon codec and returns an array of values.
+ * @param int $symsize symbol size, bits
+ * @param int $gfpoly Field generator polynomial coefficients
+ * @param int $fcr first root of RS code generator polynomial, index form
+ * @param int $prim primitive element to generate polynomial roots
+ * @param int $nroots RS code generator polynomial degree (number of roots)
+ * @param int $pad padding bytes at front of shortened block
+ * @return array Array of RS values:- mm = Bits per symbol;
- nn = Symbols per block;
- alpha_to = log lookup table array;
- index_of = Antilog lookup table array;
- genpoly = Generator polynomial array;
- nroots = Number of generator;
- roots = number of parity symbols;
- fcr = First consecutive root, index form;
- prim = Primitive element, index form;
- iprim = prim-th root of 1, index form;
- pad = Padding bytes in shortened block;
- gfpoly
.
+ */
+ protected function init_rs_char($symsize, $gfpoly, $fcr, $prim, $nroots, $pad) {
+ // Based on Reed solomon encoder by Phil Karn, KA9Q (GNU-LGPLv2)
+ $rs = null;
+ // Check parameter ranges
+ if (($symsize < 0) OR ($symsize > 8)) {
+ return $rs;
+ }
+ if (($fcr < 0) OR ($fcr >= (1<<$symsize))) {
+ return $rs;
+ }
+ if (($prim <= 0) OR ($prim >= (1<<$symsize))) {
+ return $rs;
+ }
+ if (($nroots < 0) OR ($nroots >= (1<<$symsize))) {
+ return $rs;
+ }
+ if (($pad < 0) OR ($pad >= ((1<<$symsize) -1 - $nroots))) {
+ return $rs;
+ }
+ $rs = array();
+ $rs['mm'] = $symsize;
+ $rs['nn'] = (1 << $symsize) - 1;
+ $rs['pad'] = $pad;
+ $rs['alpha_to'] = array_fill(0, ($rs['nn'] + 1), 0);
+ $rs['index_of'] = array_fill(0, ($rs['nn'] + 1), 0);
+ // PHP style macro replacement ;)
+ $NN =& $rs['nn'];
+ $A0 =& $NN;
+ // Generate Galois field lookup tables
+ $rs['index_of'][0] = $A0; // log(zero) = -inf
+ $rs['alpha_to'][$A0] = 0; // alpha**-inf = 0
+ $sr = 1;
+ for ($i=0; $i<$rs['nn']; ++$i) {
+ $rs['index_of'][$sr] = $i;
+ $rs['alpha_to'][$i] = $sr;
+ $sr <<= 1;
+ if ($sr & (1 << $symsize)) {
+ $sr ^= $gfpoly;
+ }
+ $sr &= $rs['nn'];
+ }
+ if ($sr != 1) {
+ // field generator polynomial is not primitive!
+ return NULL;
+ }
+ // Form RS code generator polynomial from its roots
+ $rs['genpoly'] = array_fill(0, ($nroots + 1), 0);
+ $rs['fcr'] = $fcr;
+ $rs['prim'] = $prim;
+ $rs['nroots'] = $nroots;
+ $rs['gfpoly'] = $gfpoly;
+ // Find prim-th root of 1, used in decoding
+ for ($iprim=1; ($iprim % $prim) != 0; $iprim += $rs['nn']) {
+ ; // intentional empty-body loop!
+ }
+ $rs['iprim'] = (int)($iprim / $prim);
+ $rs['genpoly'][0] = 1;
+
+
+ for ($i = 0,$root=$fcr*$prim; $i < $nroots; $i++, $root += $prim) {
+ $rs['genpoly'][$i+1] = 1;
+ // Multiply rs->genpoly[] by @**(root + x)
+ for ($j = $i; $j > 0; --$j) {
+ if ($rs['genpoly'][$j] != 0) {
+ $rs['genpoly'][$j] = $rs['genpoly'][$j-1] ^ $rs['alpha_to'][$this->modnn($rs, $rs['index_of'][$rs['genpoly'][$j]] + $root)];
+ } else {
+ $rs['genpoly'][$j] = $rs['genpoly'][$j-1];
+ }
+ }
+ // rs->genpoly[0] can never be zero
+ $rs['genpoly'][0] = $rs['alpha_to'][$this->modnn($rs, $rs['index_of'][$rs['genpoly'][0]] + $root)];
+ }
+ // convert rs->genpoly[] to index form for quicker encoding
+ for ($i = 0; $i <= $nroots; ++$i) {
+ $rs['genpoly'][$i] = $rs['index_of'][$rs['genpoly'][$i]];
+ }
+ return $rs;
+ }
+
+ /**
+ * Encode a Reed-Solomon codec and returns the parity array
+ * @param array $rs RS values
+ * @param array $data data
+ * @param array $parity parity
+ * @return parity array
+ */
+ protected function encode_rs_char($rs, $data, $parity) {
+ $MM =& $rs['mm']; // bits per symbol
+ $NN =& $rs['nn']; // the total number of symbols in a RS block
+ $ALPHA_TO =& $rs['alpha_to']; // the address of an array of NN elements to convert Galois field elements in index (log) form to polynomial form
+ $INDEX_OF =& $rs['index_of']; // the address of an array of NN elements to convert Galois field elements in polynomial form to index (log) form
+ $GENPOLY =& $rs['genpoly']; // an array of NROOTS+1 elements containing the generator polynomial in index form
+ $NROOTS =& $rs['nroots']; // the number of roots in the RS code generator polynomial, which is the same as the number of parity symbols in a block
+ $FCR =& $rs['fcr']; // first consecutive root, index form
+ $PRIM =& $rs['prim']; // primitive element, index form
+ $IPRIM =& $rs['iprim']; // prim-th root of 1, index form
+ $PAD =& $rs['pad']; // the number of pad symbols in a block
+ $A0 =& $NN;
+ $parity = array_fill(0, $NROOTS, 0);
+ for ($i=0; $i < ($NN - $NROOTS - $PAD); $i++) {
+ $feedback = $INDEX_OF[$data[$i] ^ $parity[0]];
+ if ($feedback != $A0) {
+ // feedback term is non-zero
+ // This line is unnecessary when GENPOLY[NROOTS] is unity, as it must
+ // always be for the polynomials constructed by init_rs()
+ $feedback = $this->modnn($rs, $NN - $GENPOLY[$NROOTS] + $feedback);
+ for ($j=1; $j < $NROOTS; ++$j) {
+ $parity[$j] ^= $ALPHA_TO[$this->modnn($rs, $feedback + $GENPOLY[($NROOTS - $j)])];
+ }
+ }
+ // Shift
+ array_shift($parity);
+ if ($feedback != $A0) {
+ array_push($parity, $ALPHA_TO[$this->modnn($rs, $feedback + $GENPOLY[0])]);
+ } else {
+ array_push($parity, 0);
+ }
+ }
+ return $parity;
+ }
+
+ } // end QRcode class
+
+} // END OF "class_exists QRcode"
+?>
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_1.dat
new file mode 100644
index 000000000..be28feac4
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_1.dat
@@ -0,0 +1,2 @@
+xڝ
E9u`"PńC牗T!0$
+EɲQmh۾9{kI" 9Ln)Ap־>^zmnŖ;mn
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_1.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_1.png
new file mode 100644
index 000000000..86ce6e98d
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_1.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_10.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_10.dat
new file mode 100644
index 000000000..aff163f68
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_10.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_10.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_10.png
new file mode 100644
index 000000000..dbfcd70b5
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_10.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_11.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_11.dat
new file mode 100644
index 000000000..95af68a47
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_11.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_11.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_11.png
new file mode 100644
index 000000000..c07c761f1
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_11.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_12.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_12.dat
new file mode 100644
index 000000000..73228b362
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_12.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_12.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_12.png
new file mode 100644
index 000000000..8ba67822c
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_12.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_13.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_13.dat
new file mode 100644
index 000000000..2256f0e34
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_13.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_13.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_13.png
new file mode 100644
index 000000000..6e49d35a0
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_13.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_14.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_14.dat
new file mode 100644
index 000000000..e9ae09329
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_14.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_14.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_14.png
new file mode 100644
index 000000000..efc36c034
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_14.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_15.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_15.dat
new file mode 100644
index 000000000..18727818d
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_15.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_15.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_15.png
new file mode 100644
index 000000000..a9f416c7c
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_15.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_16.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_16.dat
new file mode 100644
index 000000000..60af67845
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_16.dat
@@ -0,0 +1 @@
+xA E]sIX;n6`qW6`%A/3!!g̡1N)E|;>6⸏97$c]kkw1[mC͜cR>E,hʼnp#xFyWVWG3+˓S}Ğ#G8b^c^cpc&3YQ"vk9܇} ĿQL/
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_16.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_16.png
new file mode 100644
index 000000000..6ac8fe890
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_16.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_17.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_17.dat
new file mode 100644
index 000000000..87f0cf593
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_17.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_17.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_17.png
new file mode 100644
index 000000000..5b929ac73
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_17.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_18.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_18.dat
new file mode 100644
index 000000000..bb7138c1d
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_18.dat
@@ -0,0 +1,2 @@
+xA
+0E]օ,2;s&͚hO1&09OIv@DD&ىKXFv<dq9<%hYs!(ds;~||b(Yůg#`KSĶsidߍLg:әt/gmkM3{4rTQes><әt3;H#љt3Y+oghٽlnF>i^#awm;g~pgNs{6zp'
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_18.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_18.png
new file mode 100644
index 000000000..ee0d6a35e
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_18.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_19.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_19.dat
new file mode 100644
index 000000000..95e26adc1
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_19.dat
@@ -0,0 +1,3 @@
+xA
+ E.No7ћiiRN2W%x@ڜ'
+u6.*S;}àTzrt%,};)ZLP$qgLdJ;w.]z#[͝Og" B}};w#1Gb;w_C+w@Dfu2N9R7|pWkk
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_19.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_19.png
new file mode 100644
index 000000000..20fddd84c
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_19.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_2.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_2.dat
new file mode 100644
index 000000000..7e42f31ca
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_2.dat
@@ -0,0 +1 @@
+x͒
F{v&&Y+?Z1S'y!a815&۴HٞclF1#6f6O7C֏8gIfB\DԻ(
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_2.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_2.png
new file mode 100644
index 000000000..9c150ebe3
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_2.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_20.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_20.dat
new file mode 100644
index 000000000..d5ecc1d8a
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_20.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_20.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_20.png
new file mode 100644
index 000000000..23a061d54
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_20.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_21.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_21.dat
new file mode 100644
index 000000000..1974dd9d4
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_21.dat
@@ -0,0 +1 @@
+xA E]sIX;n6Upв]٘<i-eW)ŕ
H\jvqHL\6ЅrILܹ%@Vv(P4|Xngɝ~]Du1Us S\,2N?DKF-:eJ]p_,a0`X`w,`X]5Y4{2vJs9)u۹,]^_7$_
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_21.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_21.png
new file mode 100644
index 000000000..291598c72
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_21.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_22.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_22.dat
new file mode 100644
index 000000000..0f01802d2
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_22.dat
@@ -0,0 +1,3 @@
+xA
+0E]{.]{{{ZBepwe@VERZ3"*2o4y)i#dbdF҅I"4WIu45x.ZS{8k={o.q[:帒qy
+)t#N8dCj-OOG}:/:sz!)^IO-
7p
7$}>ɷ7p
tssrs
Vmҹ}R~7&?7ԦIbh{<Mi-
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_23.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_23.png
new file mode 100644
index 000000000..b8f16ae23
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_23.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_24.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_24.dat
new file mode 100644
index 000000000..7b92e29c4
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_24.dat
@@ -0,0 +1 @@
+xA EMX0;nVP4HSSxU3/OLiJ4VJC%6VR&DBHjDJ??BlcDZ'UXUޏ0ywįj똳3ścj{:GqGNv;笓J<]#8#8H'GqGtr:9#8#8ؓhNt_>teS^\gQe?vuo;>*wlm
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_24.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_24.png
new file mode 100644
index 000000000..397c64f85
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_24.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_25.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_25.dat
new file mode 100644
index 000000000..ba125182e
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_25.dat
@@ -0,0 +1,3 @@
+xA
+ s낋]rxY51mMBG
+*Sx|Ua5ƵZ-,1HPRjX5iG>WR/+uT廯ӯ嗴u[Sa[kv5+5nJ%+VXbŊ߬u'SRtzZ++VXbŊٟٟٟ+VXb}Ŋ+VXVI+kq[toVZvoNVw}{r<ýR"R]
Wr}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_25.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_25.png
new file mode 100644
index 000000000..25bc4454a
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_25.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_26.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_26.dat
new file mode 100644
index 000000000..d34a73f15
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_26.dat
@@ -0,0 +1,2 @@
+xA
+ Eօ,t77ћU E)i7*~cXEBFC6:&L,Mv.KgոYM>>mۚ?vmg?ұηdCUIkE\Msfafa>[sӈ9쬩ެ8b]LgEo w1
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_26.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_26.png
new file mode 100644
index 000000000..f4a6b3938
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_26.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_27.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_27.dat
new file mode 100644
index 000000000..b4d9ffd4f
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_27.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_27.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_27.png
new file mode 100644
index 000000000..8419ec230
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_27.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_28.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_28.dat
new file mode 100644
index 000000000..8cbaa1961
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_28.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_28.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_28.png
new file mode 100644
index 000000000..7609d8e1f
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_28.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_29.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_29.dat
new file mode 100644
index 000000000..5e4a71103
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_29.dat
@@ -0,0 +1,2 @@
+xA a @n7+*4!?J 抮]STf)sI"Ȕb0|"Luٸ,E1\6*uQ?>aυR-rn.ꯋ\T:*)|),,x_}:^RUoɢu~މX`XЏЏЏЏ_`X`XЏЏЏ_`X`XЏЏЏЏwbX`PU)D"c{z3<}^?bm잃a.]
+{Q6uT,9
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_29.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_29.png
new file mode 100644
index 000000000..ffe072c86
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_29.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_3.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_3.dat
new file mode 100644
index 000000000..188d531c2
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_3.dat
@@ -0,0 +1 @@
+x
E{v&&Y+bk'ya:TXl$W+ӏv9}gR@H0YPBEm?s"bt2cn:ﺭ;YzQ7
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_3.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_3.png
new file mode 100644
index 000000000..945ee7cb9
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_3.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_30.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_30.dat
new file mode 100644
index 000000000..44cf3d317
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_30.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_30.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_30.png
new file mode 100644
index 000000000..75dbddd24
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_30.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_31.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_31.dat
new file mode 100644
index 000000000..ce429d0a6
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_31.dat
@@ -0,0 +1 @@
+xA a
&r4yķ!mV3Iv!Ҝ2i\NSS4EF2+65e/Ws]!?p=S~Đ?+x6r6y}ǴeR1-WllҌXz/>V櫷:ñA8-+mTbllltM&]ll&]Ill&]y
6`
6`iuyXWi\tz>.zk
t77wJϔ4w҈85
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_31.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_31.png
new file mode 100644
index 000000000..b14d1fa26
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_31.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_32.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_32.dat
new file mode 100644
index 000000000..aaa0808e2
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_32.dat
@@ -0,0 +1,2 @@
+x
+ ־. Dl,Mz6Ç gcJD;'.AIqމI,IrYFk%DOy|EDD(L_Y>*ߚ?aOkL_<[c>c˘uLI%#0#0#otѢ}4fv_)Eph5R881#0#0itZ#0#0#0itZ#0#0#0itZl0#09q"HܜHQ"L5}-Yk`>z鸳4&p!!`:5
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_32.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_32.png
new file mode 100644
index 000000000..58d42db3c
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_32.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_33.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_33.dat
new file mode 100644
index 000000000..a2613755a
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_33.dat
@@ -0,0 +1,14 @@
+xA a@n7+*L++柮bb*LCckHrjJ5Yi~0_TT}e>5b_w͟?\Rai+7W\wLUNL
++
++jOkc\˩|%o}8
++
++
++3g
++
++
++3g@
++
++
++:RXB9I=ko/Swؘٯ`gr_ٙYVSYzIefnmQoz
>
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_33.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_33.png
new file mode 100644
index 000000000..924c728e0
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_33.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_34.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_34.dat
new file mode 100644
index 000000000..7ceb0259d
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_34.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_34.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_34.png
new file mode 100644
index 000000000..a477042d8
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_34.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_35.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_35.dat
new file mode 100644
index 000000000..56bc3e28e
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_35.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_35.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_35.png
new file mode 100644
index 000000000..d29806c60
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_35.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_36.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_36.dat
new file mode 100644
index 000000000..282c60d23
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_36.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_36.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_36.png
new file mode 100644
index 000000000..96ecb4213
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_36.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_37.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_37.dat
new file mode 100644
index 000000000..015c0f24b
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_37.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_37.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_37.png
new file mode 100644
index 000000000..fcc51627d
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_37.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_38.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_38.dat
new file mode 100644
index 000000000..71cf53eb5
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_38.dat
@@ -0,0 +1 @@
+xA0ЎuA2;Нk(gytp9$D\e^'t-aIFMSkIŤ:7|LkN8N7i}i,[WgӴ?31iN}}=OM:4)SL2eʔ)SL#$
JJM:}]L٧SQL2eʔ)SL2աPt(:)SL2eʔ)S:ECq2eʔ)SL2eʔECѡ8O2eʔ)SL2eTCѡPL2eʔ)SL2ݓsJCIKԂi93n_+Ri4\g;%
}an
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_38.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_38.png
new file mode 100644
index 000000000..89238f3c5
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_38.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_39.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_39.dat
new file mode 100644
index 000000000..53511f736
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_39.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_39.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_39.png
new file mode 100644
index 000000000..1dc9cd1bc
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_39.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_4.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_4.dat
new file mode 100644
index 000000000..67b30e82a
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_4.dat
@@ -0,0 +1 @@
+x
E=u
pجQCOM'ˏ$ @3eF\FNXRyؾC{a8RŃa2@qkH1(`cj~0ܨعnXGĀ
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_4.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_4.png
new file mode 100644
index 000000000..b72f9e70d
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_4.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_40.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_40.dat
new file mode 100644
index 000000000..90d36dd13
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_40.dat
@@ -0,0 +1,2 @@
+xA@Ь@o7`Qfe䕫PA><]߳bZn^AQ}[9^]ynajM܇K̘1cƌ3f̘1{W5}{7lMޚxI<Kαyl3f̘1cƌ3f̘1ۻٻ={αyl3f̘1cƌ3f̘1ۻٻ={αyl3f̘1cƌ3f̘1ۻٻ={αyl3f̘1cƌ3f̘1ۻٻ={αyl3f̘1cƌ3f̘SʑӒ7HKg\u_r'4[-]qL8ƝY1q!/(%
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_40.png b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_40.png
new file mode 100644
index 000000000..8034d862d
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_40.png differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_5.dat
new file mode 100644
index 000000000..d5dafe186
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/frame_5.dat
@@ -0,0 +1 @@
+x1 Eu7ЛZ|NDB0@R$l,->VKZ[I9+Es=ϤL1̄[FZU4?i<;7;P#W-[ݯ6ddddddc",;"sk摑Q&erw######L.摑Иy1^˲\3 v
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_117_0.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_117_0.dat
new file mode 100644
index 000000000..781c7f875
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_117_0.dat
@@ -0,0 +1,2 @@
+xA
+0}OrR,#3,o5Cq:;;wvNJZG=m}
ѱ2iRkj_YYYYYYYYe_/WVVVVVVkd-Ϻ,#OZc]|{ž$
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_121_0.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_121_0.dat
new file mode 100644
index 000000000..68810c347
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_121_0.dat
@@ -0,0 +1 @@
+x1 О/w
YMS8>2SFOEcW\ۼ{cpKGBКmxhfffffff/s22W|*d1*5̬RWas\xm~8߮r0wjsdm&y
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_125_0.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_125_0.dat
new file mode 100644
index 000000000..2c73ef1a8
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_125_0.dat
@@ -0,0 +1,2 @@
+xA
+ н_TH`3AOL4k(ewGW. #2} \Ygggggggggg_d>j^s;;;;;;;;;;'q;;;;;;;;;'˰qu_PYw{e=dG/
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_129_0.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_129_0.dat
new file mode 100644
index 000000000..812ee8a66
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_129_0.dat
@@ -0,0 +1,2 @@
+x1
+ /*DE'hgt-}_pV \"b=s[J=8Dho۞'0X ۴e0`j"0`Wf`^P0`2Ȁ d07(Y/XLGby"pT
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_137_0.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_137_0.dat
new file mode 100644
index 000000000..f6d993b03
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_137_0.dat
@@ -0,0 +1 @@
+x1 О/+FZ?JL7Ժ*Ba%L~˻ʓCJYIWJ .K]R0a $INTwlLaL0a &Ld@PO0a &L0e@P?a &L0aDe@ &L0aMIlL&)dlgacR<$v,ɺ?U2]
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_141_0.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_141_0.dat
new file mode 100644
index 000000000..8c685c8ea
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_141_0.dat
@@ -0,0 +1,2 @@
+x=
+0нi9'EDx͘%I9+E{$m^&uS"D6ڟ]98UMbҾY[2拉Ĉ#F1bĈ%iRN潝ѳ#;#F1bĈN1i#F1bĈ#FtZ}Nk1bĈ#F1bktZ;#F1bFV-u"IoD-*7uj>bMV+
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_149_0.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_149_0.dat
new file mode 100644
index 000000000..d25835029
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_149_0.dat
@@ -0,0 +1,3 @@
+xA
+ н_MEQXP.|94e{JLv#^n[?;
+ZIV-*w˒1*+VXbŊXgwqX}JRYbŊ+VXbeΠwfeΠ^bŊ+VXbʜAʜAbŊ+VXbŊ9ٜAbŊ+VXbŊl0*0Tj`?Ϊ;X=zZr*
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_153_0.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_153_0.dat
new file mode 100644
index 000000000..fc79e9ede
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_153_0.dat
@@ -0,0 +1 @@
+x1 Н/礑h&F`Ҽ@I;PZ^X͌mf.=5[if-R+!wr˜g\j̘1cƌ3f̘1cfo.2?1z
`ƌ3f̘1cƌzƌ3f̘1cƌ3fztf3f̘1cƌ3f̘kk030cƌ3f̘1c9;Ď`vf͚̆ZϘW9
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_157_0.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_157_0.dat
new file mode 100644
index 000000000..ad749f305
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_157_0.dat
@@ -0,0 +1,2 @@
+xA
+ н_QRY
k*q͵=j7~nN.p%ڵsi.رcǎ;vر{.-W2={mgy+رcǎ;vɳ2;yּcǎ;vرcNɳ;vرcǎ;v2I9+DyI4ˠ5:Wvdqߜܴ<d2x%[U%2]&K,Ydɒ%ˡ,Sr2yd=,k_{Xdɒ%K,Yd)0m,Ydɒ%K,Yd)0m,Ydɒ%K,Yme,e%K,Ydɒ%K,eq
Ò%K,Ydɒe:I9EQ=LsI{ZtR}Sn:|R[?_*SL2eʔ)SL&ϦIO2O2eʔ)SL2e*C1PPSL2eʔ)SLP22)SL2eʔ)SLe(}2)SL2eʔ)SLe(}2)SL2eʔ)Sic7;"ޙFͦސٙvL^2}oO'r
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_173_0.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_173_0.dat
new file mode 100644
index 000000000..5ef85e7ad
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_173_0.dat
@@ -0,0 +1 @@
+x10ޯT [4v2ƽok݇;Ӳ]f֞dljlG0n+mG˖-[lٲe"Y}oV[lٲe˖-[lٲeհՃ[2lٲe˖-[lٲeհՃ[2lٲe˖-[lٲeհՃ[lٲe˖-[lٲeValٲe˖-[lٲef[BmаE;N-ۜT/rl?*
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_177_0.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_177_0.dat
new file mode 100644
index 000000000..78a26a77b
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_177_0.dat
@@ -0,0 +1,2 @@
+x1
+0>I9+?߁iևd̹xֈxN/է|{ظ8d0h=cFf̘1cƌ3f̘qq=w6;l4cƕ<nj3f̘1cƌ3fXһ1ֻcƌ3f̘1cƌ3fXbwnj3f̘1cƌ3f̘M'X&1cƌ3f̘1cƌ3ֻnn1cƌ3f̘1cƌÍ3U<
\7+(<OƌΊnj4@
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_21_0.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_21_0.dat
new file mode 100644
index 000000000..368c9941f
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_21_0.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_25_0.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_25_0.dat
new file mode 100644
index 000000000..e4a5b6d8a
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_25_0.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_29_0.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_29_0.dat
new file mode 100644
index 000000000..74a216b4f
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_29_0.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_33_0.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_33_0.dat
new file mode 100644
index 000000000..2ec712a7a
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_33_0.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_37_0.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_37_0.dat
new file mode 100644
index 000000000..1588cfce1
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_37_0.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_41_0.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_41_0.dat
new file mode 100644
index 000000000..e369027e3
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_41_0.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_45_0.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_45_0.dat
new file mode 100644
index 000000000..452f126c8
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_45_0.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_49_0.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_49_0.dat
new file mode 100644
index 000000000..fdd2aac15
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_49_0.dat
@@ -0,0 +1,2 @@
+xK E9o#?H/6g$-,X]
+xݘ;X9<Ѻq2AfH7/5We{#fި?4=N >
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_53_0.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_53_0.dat
new file mode 100644
index 000000000..572d279ef
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_53_0.dat
@@ -0,0 +1,2 @@
+xK
+@!йoQϺ:(m&s-6Z{m4YX.F٭XZij=:έb忑VH8#[Y^Xe
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_57_0.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_57_0.dat
new file mode 100644
index 000000000..ea81e6dc6
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_57_0.dat
@@ -0,0 +1,4 @@
+xA
+ {^s=YL՚
(
+ouj)
+Z7yv,ԴwVQ iGiҤDfەwo4ѤoLLȼ}4
h
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_61_0.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_61_0.dat
new file mode 100644
index 000000000..93d2444d8
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_61_0.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_65_0.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_65_0.dat
new file mode 100644
index 000000000..df29d7bfb
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_65_0.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_69_0.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_69_0.dat
new file mode 100644
index 000000000..8a2cfbd7c
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_69_0.dat
@@ -0,0 +1 @@
+xK =_+mBd|Q"s+1"),=Ea T"ŐnE-3,KYw=ZZT.,K1#֞!Ŋ+V嬪.2XbŊ+VX.kBzwձ̀gkYZ
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_89_0.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_89_0.dat
new file mode 100644
index 000000000..aaa4c5267
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_89_0.dat
@@ -0,0 +1 @@
+x1 ὧi9'Hl?L^"&M?bq?˸,9!z]VScƌ3_c!`n3f̘1č 3f̘1/f>.Uc˻;
2;Y+7
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_93_0.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_93_0.dat
new file mode 100644
index 000000000..e218fa0ef
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_93_0.dat
@@ -0,0 +1,3 @@
+xK
+ EyV,OmޠrPH0{2bc{tQ]
+{Q{{弬֒ǎ;v_ڳ}L}l߱cǎ;v̑̑̑رcǎ.Legw3qeѾ@i
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_97_0.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_97_0.dat
new file mode 100644
index 000000000..74ac719d0
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_0/mask_97_0.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_101_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_101_1.dat
new file mode 100644
index 000000000..ec939b521
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_101_1.dat
@@ -0,0 +1,2 @@
+x1
+ н\QEd 1N<#Ֆ-7u.lԦeiXXXXXRZVVeIo1,,,,,v%?gaaaaYK&K=/+ۍ˱ގ
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_105_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_105_1.dat
new file mode 100644
index 000000000..e1f5c99b4
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_105_1.dat
@@ -0,0 +1 @@
+x1 Ӕ_Υb
KB?"*#WʘtgӎJqUM9TLLvǤLLLLLLzgG01111yiߘ4m=՛n+2
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_109_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_109_1.dat
new file mode 100644
index 000000000..7e0d6d164
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_109_1.dat
@@ -0,0 +1 @@
+xֱ
>ӘK}:!iY'*3]fsmb[JƶŖK9}cccccc'u.6Ʀs6666R[^g{/lٷ7͂
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_113_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_113_1.dat
new file mode 100644
index 000000000..1dd666d9b
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_113_1.dat
@@ -0,0 +1 @@
+x1
-8fL(pBlDM9";-;?1p{\%-3:@ad4*Nadddddd########c]751xYu
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_117_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_117_1.dat
new file mode 100644
index 000000000..8921f6437
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_117_1.dat
@@ -0,0 +1,2 @@
+xֻ
>ӘK$^8YQSV'z8jzʇ^]סekXYYYYYYYjݵ#
++yeeeeeeee#WVVVVVVVV;"+yeeeeeeel'e;b&^9{/J$p
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_121_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_121_1.dat
new file mode 100644
index 000000000..64bd8ba04
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_121_1.dat
@@ -0,0 +1,2 @@
+x1
+ н\CPbїE$DdƩYtڅλ0$ήꝝga7yٯ痽Y??{{D
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_129_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_129_1.dat
new file mode 100644
index 000000000..62cd1c9a1
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_129_1.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_133_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_133_1.dat
new file mode 100644
index 000000000..18d68dce8
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_133_1.dat
@@ -0,0 +1 @@
+x1 Ӕ_΅hh|"zۉ-*dNHQĢRÂ,X`c9Y(na_`,X,X,X`#:8,X`Bd¾`,X|ϢY\X;7-;`
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_137_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_137_1.dat
new file mode 100644
index 000000000..284d7beab
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_137_1.dat
@@ -0,0 +1,3 @@
+x1
+0ӤKh]D,-t #ڌQ[T Ks7_?9|B&X^L0a&3M&L0a &2D4c0a &LȀЌe &L0abwȀf,&L0a7&y2anoL<01O
+
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_141_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_141_1.dat
new file mode 100644
index 000000000..83220ddb4
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_141_1.dat
@@ -0,0 +1,2 @@
+x1
+ >946)3$`suʮ>Wd
)g'M{3\d6ubذaÆ
6lؼn]Nذ9FްaÆ
6lذa3a#oذaÆ
6lذذ5e16lذaÆ
]Sbk6lذaÆ
mͤ;CcfIdsG
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_145_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_145_1.dat
new file mode 100644
index 000000000..6a9950f7a
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_145_1.dat
@@ -0,0 +1 @@
+x!0@k4a)q2i.YCUO{35UZFn]fN>bdwtzJF}F1bĈ#F(F6r1bĈ#F1E1ilF1bĈ#FtF#F1bĈ#FtZ}##F1bĈleHGܣ@ٝ
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_149_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_149_1.dat
new file mode 100644
index 000000000..02a3cdc6e
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_149_1.dat
@@ -0,0 +1 @@
+x1 Ӕ_΅qH_Xci#Gd̘Ք՛gLU^ݮVR>dKVXbŊ+VXeoXJ_bŊ+VXb;ݙ+}Ŋ+VXbŊ+VAVngŊ+VXbŊ}++VXbŊVj>hewf*`uTq
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_153_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_153_1.dat
new file mode 100644
index 000000000..2abfca20b
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_153_1.dat
@@ -0,0 +1,2 @@
+x1
+0\9btEc'HH9efߞmffM#.̘1cƌ3f̘1cf73f̘g̘1cƌ3f̘1co2c]?3f̘1cƌ3f5Mf3f̘1cƌ3f̘17utf3f̘1cƌ3f̘=lj3>V
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_157_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_157_1.dat
new file mode 100644
index 000000000..17344b891
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_157_1.dat
@@ -0,0 +1,2 @@
+x1
+ >94Sd/51V)SkJv7eGcǎ;vرc]Zٱc'رcǎ;vر+رg;vرcǎ;}V`N+رcǎ;v:;v;vرcǎ;;}Vޱcǎ;vص'vz#;]klwoA`
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_161_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_161_1.dat
new file mode 100644
index 000000000..669ade1b8
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_161_1.dat
@@ -0,0 +1 @@
+x10_΅Xšyi~Qbkvp7'M
u=]([2dȐ+\'22dȐ!C2s0/3d()2dȐ!C241dh 2dȐ!C2dhcȐSL2eʔ)SL2M
SLSL2eʔ)SL2M}LSSL2eʔ)SLeSy)SŔ)SL2eʔ)S;ٔ)S;)SL2eʔ)Sv()Sv()SL2eʔ)SLdT6}a*3mljmzC'
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_173_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_173_1.dat
new file mode 100644
index 000000000..436918c0b
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_173_1.dat
@@ -0,0 +1 @@
+x1 Ӕ_Υ''@y]X1?"g:1犝fn˶˻mm.?lٲe˖-F>glٲ2lٲe˖-[lٲeO`˖e˖-[lٲe˖-[l lٲlٲe˖-[lٲeVO`˖e˖-[lٲe˖-[z0}[z0y˖-[lٲe˖-[Ee[hOVWö=t*|
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_177_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_177_1.dat
new file mode 100644
index 000000000..12e2e522f
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_177_1.dat
@@ -0,0 +1 @@
+x1 Ep0X,a#r}6}nj~\8ƌ3f̘1cƌ7{3f,y3f̘1cƌ3fX_`X&3f̘1cƌ3f̘M_1cy̘1cƌ3f̘1cƌ+3f,y3f̘1cƌ3fX_bX&3f̘1cƌ3fx2dX'x[cy|
3
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_21_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_21_1.dat
new file mode 100644
index 000000000..f87e0a112
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_21_1.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_25_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_25_1.dat
new file mode 100644
index 000000000..3a225e30f
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_25_1.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_29_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_29_1.dat
new file mode 100644
index 000000000..0a1cb3b5d
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_29_1.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_33_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_33_1.dat
new file mode 100644
index 000000000..318949df0
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_33_1.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_37_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_37_1.dat
new file mode 100644
index 000000000..5bd9e3aa0
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_37_1.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_41_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_41_1.dat
new file mode 100644
index 000000000..52e9e58f4
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_41_1.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_45_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_45_1.dat
new file mode 100644
index 000000000..b35c567dc
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_45_1.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_49_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_49_1.dat
new file mode 100644
index 000000000..d20d71710
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_49_1.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_53_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_53_1.dat
new file mode 100644
index 000000000..a676d7dfa
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_53_1.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_57_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_57_1.dat
new file mode 100644
index 000000000..896ed4357
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_57_1.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_61_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_61_1.dat
new file mode 100644
index 000000000..4165a4bd2
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_61_1.dat
@@ -0,0 +1 @@
+x30CbpPi`@&H^nadQG{n_.4Iy킎`)-5*(of[sm}6YM ;;;;;G{zطz1vw}=wuL%?"=~ei
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_97_1.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_97_1.dat
new file mode 100644
index 000000000..24fa60fc3
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_1/mask_97_1.dat
@@ -0,0 +1,2 @@
+x1
+0н1\tncKD"H$DH$D"Q&WerH$D"*x[(?/'nd
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_117_2.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_117_2.dat
new file mode 100644
index 000000000..b4dcce46f
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_117_2.dat
@@ -0,0 +1,2 @@
+x1
+ >94!m dOs\0X,la5#E>Z[ַRT*JR?Q-*T*JR?UW*JRTݟ+JRԤ~m5;S&+
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_121_2.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_121_2.dat
new file mode 100644
index 000000000..a2a0097b1
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_121_2.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_125_2.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_125_2.dat
new file mode 100644
index 000000000..0ea40fdae
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_125_2.dat
@@ -0,0 +1 @@
+x! PӔ_@
U(kp@^Mڮ5-:VF_\t:NtyNqt:NtG;Nt:.8:NtzA}yNq;+n&
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_129_2.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_129_2.dat
new file mode 100644
index 000000000..bf048394b
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_129_2.dat
@@ -0,0 +1,2 @@
+x1
+0н_KVڡ'.!w]A0X~ !࣠fK# xFy4vey@^+~ L#veI
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_133_2.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_133_2.dat
new file mode 100644
index 000000000..9e78b6de5
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_133_2.dat
@@ -0,0 +1,10 @@
+x1
+ н&`LQ-g=Aqbʪl
fƄȚ44&
)OȚYF4444444444c4~9S:3ЌטpǮ>
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_145_2.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_145_2.dat
new file mode 100644
index 000000000..9ff2bbf3f
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_145_2.dat
@@ -0,0 +1,4 @@
+x1
+ нr]
+,tQ^&C~
+щj~mɾ.FgMDDDDDDDDDDDSTDHdZL+ɴDDDDDDDDDDD2-'"""""""":BתEYDd
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_149_2.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_149_2.dat
new file mode 100644
index 000000000..d52e0484b
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_149_2.dat
@@ -0,0 +1 @@
+x;@/gcaGBXB'-ouէUQdRVOmT*ǫ;;j廝Ee2PQQQQQQQQQQQTTTTTTTTTTTTr33R&Tskz_e2P=d
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_153_2.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_153_2.dat
new file mode 100644
index 000000000..3b0604101
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_153_2.dat
@@ -0,0 +1,2 @@
+x1
+0Ӥ8ZP!BZu賶"bu*)]MFFFFFFFFFFFF%= #ddddddddddddr
ot2yFFFFFFFFFFFF& #k5L
2222222222(Y7"d@H
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_157_2.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_157_2.dat
new file mode 100644
index 000000000..2baf535e2
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_157_2.dat
@@ -0,0 +1,3 @@
+x1
+0>s6MqUH1X&U̘f/u-'.[KGGGGGGGGGGH|NG(ttttttttttNF;::::::::::}Nz$
+>nA#^AG(t =3{
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_161_2.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_161_2.dat
new file mode 100644
index 000000000..d2df7594e
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_161_2.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_165_2.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_165_2.dat
new file mode 100644
index 000000000..2e6cd7c6f
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_165_2.dat
@@ -0,0 +1,2 @@
+x1
+0Ӥ?BVUG%*+_fs MIIIIIIIII2d;l4()))))))))))eqJنIDIIIIIIIIIII)۠mPRRRRRRRRRRR6l
JJJJJJJJJJJJن}RaQRRRRRRRRRRNeK?R퐔͔&W3U
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_169_2.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_169_2.dat
new file mode 100644
index 000000000..4052062b8
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_169_2.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_173_2.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_173_2.dat
new file mode 100644
index 000000000..0a30ba530
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_173_2.dat
@@ -0,0 +1 @@
+x+@Pift:>y &dU߬S[]5Z;a5V۞A[Z˴VՃI0ZZZZZZZZZZZZZZ=-Lhi`VFK?ݧhioJ0}o
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_177_2.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_177_2.dat
new file mode 100644
index 000000000..d2c52f990
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_177_2.dat
@@ -0,0 +1,2 @@
+x1
+ E>Y4V$~,C&U;Ook5bϙGx9%&&&&&&&&&&&n$OL|v#&&&&&&&&&&&&&bbݍXw#&l7bbbbbbbbbbbbbbM"l7bbbbbbbbbbbbbbMa!&݈3)U*F>
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_45_2.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_45_2.dat
new file mode 100644
index 000000000..ad44ff188
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_45_2.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_49_2.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_49_2.dat
new file mode 100644
index 000000000..6e8edff24
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_49_2.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_53_2.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_53_2.dat
new file mode 100644
index 000000000..682cae2aa
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_53_2.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_57_2.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_57_2.dat
new file mode 100644
index 000000000..66a5c056b
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_57_2.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_61_2.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_61_2.dat
new file mode 100644
index 000000000..77d3815eb
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_61_2.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_65_2.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_65_2.dat
new file mode 100644
index 000000000..caf184ada
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_65_2.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_69_2.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_69_2.dat
new file mode 100644
index 000000000..6a3801bf5
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_69_2.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_73_2.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_73_2.dat
new file mode 100644
index 000000000..74945b718
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_73_2.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_77_2.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_77_2.dat
new file mode 100644
index 000000000..903cba4a0
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_77_2.dat
@@ -0,0 +1 @@
+x1 н_CM>Gt ѫe+FWZEm&gއFѶhF+t/FYvFj[*7a
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_81_2.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_81_2.dat
new file mode 100644
index 000000000..17a9ac2a1
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_81_2.dat
@@ -0,0 +1,2 @@
+x1
+0н_KҩVi!O\"A]:xbW1uȦ&_T 6H$U^D~bׯb=gX
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_85_2.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_85_2.dat
new file mode 100644
index 000000000..72c74ff9a
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_85_2.dat
@@ -0,0 +1,2 @@
+x1
+0=1\B7O$A0$8Wwjguu槊RT*uS֧JRTJRRޢN浘V
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_89_2.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_89_2.dat
new file mode 100644
index 000000000..06c9a4fe3
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_2/mask_89_2.dat
@@ -0,0 +1 @@
+xٱ 0>/&E*cQqŃzf$rM)_%s_d3KO1^aL,$H"$KzRPt[I&X9$H"$I$ysI$DI$ɓI$I$Dɍ%es!=LAZ5'̓IVrn/2oƅ
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_113_3.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_113_3.dat
new file mode 100644
index 000000000..023b27304
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_113_3.dat
@@ -0,0 +1,2 @@
+xA
+0D}NrnDFj2KCt?WݲZi.qoP%Smj7ަ:*N:@:***fW9d2*j*}S@`*j৪6Jlѿ}}էTUa24hnt
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_117_3.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_117_3.dat
new file mode 100644
index 000000000..79cc04d14
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_117_3.dat
@@ -0,0 +1,4 @@
+x1
+0]Q.xIB$?~!z#E)RHZ@bl-)ݿ<ߧ*OUR"5&5*ieJ]+
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_145_3.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_145_3.dat
new file mode 100644
index 000000000..338b7e7a8
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_145_3.dat
@@ -0,0 +1,3 @@
+x
+@|:^Jy̡yMj-'
+9VS֦K9e)PyUwe-m jԨQF5jԨRi٫F4_wk}0+jRBRF5jԨQeOMBJHjԨQF5jwP״˪IH I5jԨQFͳc w5jԨQF:zS*2UZ_C*e_OZ%dIȯb
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_149_3.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_149_3.dat
new file mode 100644
index 000000000..30bc5fabc
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_149_3.dat
@@ -0,0 +1 @@
+xA0}Oܠ⦐H頯'Z2{oV|Ι%>yR{!8ÂI+JpI|#f5κ[PA $H Q})&X{ט+Wb`I)5%d
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_153_3.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_153_3.dat
new file mode 100644
index 000000000..89cdec031
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_153_3.dat
@@ -0,0 +1,2 @@
+xA
+0}Ns˹)7mJ,}8X=cW^GeN}o%uJV/{%O>}ӧO}K~O>}ӧO>Q=/ї>}ӧO>}u{ח>}ӧO>}u{蟪/%?}ӧO>}ׯ.N4VMmRt(1|
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_177_3.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_177_3.dat
new file mode 100644
index 000000000..9586979a1
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_177_3.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_21_3.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_21_3.dat
new file mode 100644
index 000000000..bcb4eec49
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_21_3.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_25_3.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_25_3.dat
new file mode 100644
index 000000000..0ffc375fc
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_25_3.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_29_3.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_29_3.dat
new file mode 100644
index 000000000..6150ac128
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_29_3.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_33_3.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_33_3.dat
new file mode 100644
index 000000000..6053b5e39
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_33_3.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_37_3.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_37_3.dat
new file mode 100644
index 000000000..5dea5b9cb
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_37_3.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_41_3.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_41_3.dat
new file mode 100644
index 000000000..ca9ddc2aa
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_41_3.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_45_3.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_45_3.dat
new file mode 100644
index 000000000..3daad97f8
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_45_3.dat
@@ -0,0 +1,2 @@
+xK
+ DsFJ(&)0dЇFg![8=&iaD)d8&Aլa1'II׳79 ex߾ I&֝CuJy
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_49_3.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_49_3.dat
new file mode 100644
index 000000000..7f6508ddd
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_49_3.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_53_3.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_53_3.dat
new file mode 100644
index 000000000..8800beab1
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_53_3.dat
@@ -0,0 +1,2 @@
+xK
+0Ds !
-(.Bp&|"-t&`qQ-"9_+)Be/H8D%a~}spKFN=,;;a^t4\FSN
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_57_3.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_57_3.dat
new file mode 100644
index 000000000..4e1e5da38
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_57_3.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_61_3.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_61_3.dat
new file mode 100644
index 000000000..bf1a3cc7f
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_61_3.dat
@@ -0,0 +1,2 @@
+xA
+0fz4-%*dp!yZܫu(~=&ۓ)R2"/"<9FΊ=rb"/rw"2B#3-0-KW
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_65_3.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_65_3.dat
new file mode 100644
index 000000000..85892089b
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_65_3.dat
@@ -0,0 +1,2 @@
+xQ
+ D4\?R,!O-Nv1:cZu"UMÕF ~jK-la[^q^Q\=o-laZpUB@IKJzɢ|1Í
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_69_3.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_69_3.dat
new file mode 100644
index 000000000..55318a87b
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_69_3.dat
@@ -0,0 +1,2 @@
+x
+0{&2'd l=,Fy;$쇤WE-R:%T,O2g"",Ȣ/DyĈɧ{O䮳",:NvEWN#(&,,]x
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_73_3.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_73_3.dat
new file mode 100644
index 000000000..15be77f64
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_73_3.dat
@@ -0,0 +1,2 @@
+xQ
+0C{g;JJ?dԬK=RasJhTJ6exka\$nIE,-/XB*х=wee4t̒tLщtt߫b gFf qoddn-?
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_77_3.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_77_3.dat
new file mode 100644
index 000000000..ec7828044
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_77_3.dat
@@ -0,0 +1,2 @@
+xA
+0&BiRaK"t`I@|fXyilE:Sza18GifK*?:YC1쌞졘(ቷJ*jl*TRIKR^ؙks)c)c)JZa
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_81_3.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_81_3.dat
new file mode 100644
index 000000000..47bc0f793
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_81_3.dat
@@ -0,0 +1,2 @@
+x1
+ F=\,JGAġhj>#3X:kԹ\FM
Jhu3>TZ{PSgP'kVjժU_ۯUV=P
oO:Wҝj[Wxm
5
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_85_3.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_85_3.dat
new file mode 100644
index 000000000..02c4f8cdb
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_85_3.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_89_3.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_89_3.dat
new file mode 100644
index 000000000..2b4cb59fc
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_89_3.dat
@@ -0,0 +1,2 @@
+x1 ὧ)*.@U
|eŵ6ۢw5*)
oiK4nk>1}d>@
4XYCo ۡ1<AhFt
+
4@51Wr>7G}}x7|NgN
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_93_3.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_93_3.dat
new file mode 100644
index 000000000..b4cc8a971
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_93_3.dat
@@ -0,0 +1,2 @@
+xA
+0D}NrnJɪQ~B06na<<ׇe6MRCPL̓i9M2 LkŮdDv*"aXjBdAddZTdAdqY0exqeN&WVQvc
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_97_3.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_97_3.dat
new file mode 100644
index 000000000..7adc9ebaa
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_3/mask_97_3.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_101_4.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_101_4.dat
new file mode 100644
index 000000000..1c97dc048
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_101_4.dat
@@ -0,0 +1,2 @@
+xA Fs^1bИ]4m+8+Ve^HR]\c
+oWN#X+lHEcp\^.9qW9":.BB\0aPǨcp\ONqjpG}}$.˅
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_105_4.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_105_4.dat
new file mode 100644
index 000000000..0211cdb3a
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_105_4.dat
@@ -0,0 +1,2 @@
+xK
+0D=Mr˹ATeEFL2#鹢_I!딤Ѻ-իkmO]sST6*'8 N$'NZ^}rU*G9r|c[cN[_=5^J 1*qv
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_117_4.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_117_4.dat
new file mode 100644
index 000000000..386725918
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_117_4.dat
@@ -0,0 +1,2 @@
+x
+ н_s]4Dgn2Jj}ҾRsSWGRɧ)5Em#ܯk_"z3\rʕ+r
Lk|/{;'/#\p\p>#\p\p#>qp\p.$Iq dGR_4
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_137_4.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_137_4.dat
new file mode 100644
index 000000000..0c09c487c
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_137_4.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_141_4.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_141_4.dat
new file mode 100644
index 000000000..62b03f243
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_141_4.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_145_4.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_145_4.dat
new file mode 100644
index 000000000..33fb21124
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_145_4.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_149_4.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_149_4.dat
new file mode 100644
index 000000000..de99310f3
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_149_4.dat
@@ -0,0 +1,2 @@
+x
+!н_sm +XӋ9=.=Zka]ޒ>Kjo|SSWKZmj\Ъ2 W\qW\q"~jvtv_\qW\qW\q%g3}+++r9ArW\qW\qŕA g3WA W\qW\qW]V~v{D3Ȝ!\W^Tڍ[S7vۜgq?
+{peo383838{YXz,_OYfe3s38383\C!Ms38383r
\C?37938383\C!07M8383q,mMrskWv3~WWB
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_157_4.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_157_4.dat
new file mode 100644
index 000000000..ad5fcf69d
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_157_4.dat
@@ -0,0 +1 @@
+x10ޯs4"FP=iRX¢X0멪u 4ftl}m➭S|юSP5<]rwqwq^QN6ÏZsߙ,wqwqǝ>Μ5g;;Y}Vgw,wqwqw>9wqwq>3gY;[ww?P3Ƙggt퐮;].3w4A
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_161_4.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_161_4.dat
new file mode 100644
index 000000000..7604c4540
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_161_4.dat
@@ -0,0 +1 @@
+xA@fs!AL_|,4l)iml0' +E]N\x#2/_{7g9쏼ٷ}2r!?}-#Te9C9C9~6Sʇ겺!r!r!ۘse9C9C94_Ɯ|.r!r!s/s0 2r!r8}DwrDXΡ|x|!2
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_165_4.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_165_4.dat
new file mode 100644
index 000000000..d83d63165
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_165_4.dat
@@ -0,0 +1,3 @@
+xA
+1}Or."*?fPLHIkΫZQ8
+Gyqk-n5+?|֎kKnEŹK.K.?2.|EJ{2<:.Ku\K.K.ǝmu)_8\r%\r%\Џ;'2!_8\r%\r%\Џ;'2!_\r%\r%\rinC?nn9
RK.K.;.HqY'ݽNF?K㕢,R| My*3
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_169_4.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_169_4.dat
new file mode 100644
index 000000000..4aac95c1e
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_169_4.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_173_4.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_173_4.dat
new file mode 100644
index 000000000..9df4d865d
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_173_4.dat
@@ -0,0 +1,2 @@
+xK
+1}Nrna~ZY!Jt^5(/jkz[pj_?~v:|jwՖ_mXzo6?naCe
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_81_4.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_81_4.dat
new file mode 100644
index 000000000..dd6521613
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_81_4.dat
@@ -0,0 +1,3 @@
+xA
+0yMyXEm7"892ѸQ1ݳ+xx;t35DIY1x\:u}e/ #Th<
+UBz<5G<5{G<5<饫>]Urxu
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_85_4.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_85_4.dat
new file mode 100644
index 000000000..c8d5123e2
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_85_4.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_89_4.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_89_4.dat
new file mode 100644
index 000000000..5b9bd7ec3
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_89_4.dat
@@ -0,0 +1,2 @@
+x1
+0ὧI9% Vڀfr0}z=#9ҕ:~s1BՁg&4pgq.p.&gT05rgsgqrg捯u38k.Egmb*&7?
:
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_93_4.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_93_4.dat
new file mode 100644
index 000000000..be7f5e525
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_93_4.dat
@@ -0,0 +1,2 @@
+xK
+ ὧIn$}PŌB]N@%sfkҫ}CzoA}aʽ2|~D&l=Ywq}q\EYjK_ywqwz$==;_>+pH9Di
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_97_4.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_97_4.dat
new file mode 100644
index 000000000..5d848caad
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_4/mask_97_4.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_101_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_101_5.dat
new file mode 100644
index 000000000..c21869e83
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_101_5.dat
@@ -0,0 +1,2 @@
+x
+ E+%=M3Cbv
ѬNkûgqkqq{%Oo,iKee3[|iVh]``0ʕz˴T0Gu/q8F13:W>#ȕ0c0Q8E=F#+aX͞+cV%9W>Q]TkY-gLqD艋
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_105_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_105_5.dat
new file mode 100644
index 000000000..bc8798c64
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_105_5.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_109_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_109_5.dat
new file mode 100644
index 000000000..25a394402
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_109_5.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_113_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_113_5.dat
new file mode 100644
index 000000000..25f42b8b2
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_113_5.dat
@@ -0,0 +1,9 @@
+x
+0D^6I63[[EDqc+jy81\c
+7c?u}DK4},kkg--3[UƂyUXUXSV:ϫ՝,|кS⫰
+
+
+Vɫ*X[*
+
+
+zU*NV*JUXUXSXijTi4fZkU^_~Ux}ծZ/r
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_117_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_117_5.dat
new file mode 100644
index 000000000..f236940de
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_117_5.dat
@@ -0,0 +1 @@
+x D|Mn/*{M+pI_&m-ѾC32u?o-kgB7wc=U%yoRhӯșDo:ֶyRJkQ^aaaqOgiJ;qOg)ӊ000[vö>=>000Ofz3=>000.3Z$8\pw4:Zp:qX 7
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_121_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_121_5.dat
new file mode 100644
index 000000000..9bb5c4158
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_121_5.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_125_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_125_5.dat
new file mode 100644
index 000000000..2161c50a4
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_125_5.dat
@@ -0,0 +1,2 @@
+xA
+ E&fc;S$?؏Q4YahûyJ}9g==li.;nh_wz.qCWȧy
uPk;<<<|*q,
mkWqNl%
yyyy^2䰅sX|aaaa3ϙ9lH<<<<̿웁[n`Tq8^vy
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_129_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_129_5.dat
new file mode 100644
index 000000000..f0c1d6502
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_129_5.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_133_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_133_5.dat
new file mode 100644
index 000000000..46be8b094
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_133_5.dat
@@ -0,0 +1,2 @@
+xA
+0DѽOcr]4%1mCTxΜ[Dv={FEϏq?ݿ9keѭ}'2^c4G:3=JK-F0`#Hw'#<{~Z4:BG舻F0`G~:`#?#tw-`#?##t#F0r}Q}eR;M/k1mX=hsH"k M:3qOW}9ԖIH1G;-sڶ?[%M
+ v#;zg^3d}69Ψޙ@7҄#gv`;׳ީ\$wlv`v;ލ}7wߑa;vkA#gv`=N2wxgWӤ@n?c}SQ:Zd?+9vz)P
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_141_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_141_5.dat
new file mode 100644
index 000000000..60c1a8e81
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_141_5.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_145_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_145_5.dat
new file mode 100644
index 000000000..9303c07f9
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_145_5.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_149_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_149_5.dat
new file mode 100644
index 000000000..4256cefd0
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_149_5.dat
@@ -0,0 +1,3 @@
+x[
+0&c}-s+'^;Ax=Q_gUݏﵪxGTȺV¹UUE_IǴ;T1̠
+]W2 2|o5uꆬuI:(WKU躒rPAdAdA;
vo_zNO{2rPA9 2 29}^O挞rwQdAdAnMA9(dAdA^WZ.+G^K`}`_Fk
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_153_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_153_5.dat
new file mode 100644
index 000000000..deea09d77
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_153_5.dat
@@ -0,0 +1,2 @@
+x
+@wfЬ`D"Ie<:au,7Of۳uP6~szs,jլcVZvߨms^uHYu&l&l&_9
;]^jsO;ܔrSn&l&l9yכzArSnM6dM6dM6ރ@/$7ܔl&l&lzŽzACrSnM6dM6dOl7ᰚUuN֛FcPPS,l;HO
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_157_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_157_5.dat
new file mode 100644
index 000000000..176e2a69f
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_157_5.dat
@@ -0,0 +1 @@
+x10Dާri( r* \~>C*vs]Ŝ_{W!zﶬ/)˙vV6V,f1Ybn^o>\O],,b,f1YyVgYYYb,f1+ʳ<˳<˳1YbŬ<+ʳ,,b,f1YyVgYYYb,fukys77}vmb=wsw)tW:
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_161_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_161_5.dat
new file mode 100644
index 000000000..70d5fb008
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_161_5.dat
@@ -0,0 +1,2 @@
+xI
+@нDp@
o|m rHk㨤~co^Jzװ#5l¦S_92[}ZÊ=T2ƀP2[cV衆CYf'-X9>v~usK5`e,2,2,2-///o_q}K\reYfeYf峖o+/,\feYfeYfٳexB.e2,2,̲g+l\r16,2,>ϰ=te&_4=tU}/>>>Or5/u>/g}g}gOsvO}/g}g}ٷGo-w{r_{g}g}g_n=n]4Nkβ_M8m?SF<
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_173_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_173_5.dat
new file mode 100644
index 000000000..f9a674136
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_173_5.dat
@@ -0,0 +1,4 @@
+x[
+0&G1gD)[CzeDѷц=RN6FJmJqP}xs_}GFy;
+[;]ek[QbTmy&0 L`̄Y?رw؛ fcVN9&0 L`ׄZ}0=F=F9ANL`&0 L`BzYfI=F9AN&0 L`&0 fIsr ' L`&0 L`<i͒"9AN&0 L`VaBX",Um>
+=wZgBΜP!8
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_177_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_177_5.dat
new file mode 100644
index 000000000..b07c636b6
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_177_5.dat
@@ -0,0 +1,11 @@
+xъ0~ܾحuO,"%
:$Xui=ѶՃgƸ?Ώq.So~zW:=h1cq]Ƕi!r8Ɓ`+X
+V jj;8ƁX+
+oV`+X
+V?[1^h-ֳ5Z;rmS+
+oV`+X
+V;Z,YMB+
+V`+X
+VZeڦ}r\!W`+X
+V`+3Km>SB+
+V`+X
+Vc㊛{g;^Qq5ZUݮQL0+*&YDq*6
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_21_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_21_5.dat
new file mode 100644
index 000000000..04f97ea69
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_21_5.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_25_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_25_5.dat
new file mode 100644
index 000000000..c20b59b1f
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_25_5.dat
@@ -0,0 +1,2 @@
+xڝa
+@!4ʢ
?,""j?n=GZy:DR
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_33_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_33_5.dat
new file mode 100644
index 000000000..726d7fd75
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_33_5.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_37_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_37_5.dat
new file mode 100644
index 000000000..6d32ca6fa
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_37_5.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_41_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_41_5.dat
new file mode 100644
index 000000000..e07c6172a
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_41_5.dat
@@ -0,0 +1,2 @@
+xTA
+ 5?7XMtxҴx ?@7@~"N$Sɰ{+CA'r\Pp<ޏ- ͺ:S3sԉۻީz#qw >
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_45_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_45_5.dat
new file mode 100644
index 000000000..5168a17f9
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_45_5.dat
@@ -0,0 +1 @@
+xUA 5?U:N&Z":;4P1=bNvSGM1˛n'(κ J{Eѵs] ,sq
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_49_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_49_5.dat
new file mode 100644
index 000000000..9f3f3cd7d
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_49_5.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_53_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_53_5.dat
new file mode 100644
index 000000000..449807bae
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_53_5.dat
@@ -0,0 +1 @@
+xVA "zYf5ƐJC
A;l\,dR.\(e_ еaNi5\żaLP(;2שjN6O
u+l{y6od^
C[%
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_57_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_57_5.dat
new file mode 100644
index 000000000..c7dd81f39
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_57_5.dat
@@ -0,0 +1,2 @@
+xVA
+ 5?NlZHAbBZ0aMd`1z'"<Ր19nvͨ.)bݻ~;9Z#tB~
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_65_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_65_5.dat
new file mode 100644
index 000000000..ecd938068
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_65_5.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_69_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_69_5.dat
new file mode 100644
index 000000000..ead4edc1f
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_69_5.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_73_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_73_5.dat
new file mode 100644
index 000000000..00001176d
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_73_5.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_77_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_77_5.dat
new file mode 100644
index 000000000..1652cdc2d
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_77_5.dat
@@ -0,0 +1 @@
+xQ Cw#&C`T6ƹB(9
'ֆڢzk"hv.`cXB5[(F>71/34Ϊz^'[FyglgM>OTL4ϔ{&3Wy*ʧb*`<3;Vo0/s6n0ya[mcE
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_81_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_81_5.dat
new file mode 100644
index 000000000..71215e952
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_81_5.dat
@@ -0,0 +1,3 @@
+x
+ C~M?tzU4" }tMX2|.ɋ˙F\~m4Xu
+ٔ, w:EƄ>X̯=_]g>>zמ/)5ךkkkZsXXY{ܮ}~mt:S#&;U#)
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_85_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_85_5.dat
new file mode 100644
index 000000000..09cf0e281
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_85_5.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_89_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_89_5.dat
new file mode 100644
index 000000000..5fff53069
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_89_5.dat
@@ -0,0 +1,2 @@
+x
+ 45enpQ Gcfl^^;;b5;`kU߮j`NsO=\[a6~nLD?
!6uF%w*Ȭkf77SĆbÆXodw_mbClNۙ
ck&YVoܡBעبAl6
Jjx
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_93_5.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_93_5.dat
new file mode 100644
index 000000000..ec4240bd3
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_5/mask_93_5.dat
@@ -0,0 +1,2 @@
+xK
+0D>&&
fP^8BY5s(imҮ=f3/wۧEyYQwf[}
[90303ef̙3'3=,ͼwxDַ.,;s%g,,,=Rὓ7uKKTD<(n lYhV۹sޕyPEtyY]ns
;ss,!LkԅcbL12cX91Z#XEn#;svT~L~LR11vs.1111J1&؍Ń111J1&ƞgKLƪjlk{gڞ5K1/ǐ~,ac$
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_105_6.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_105_6.dat
new file mode 100644
index 000000000..a58fec749
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_105_6.dat
@@ -0,0 +1,3 @@
+xQ
+@DskBZ#o)Sd}Gܷl쯯^)G]S4S?#BZ:+{sHKNiI!me1
+RWe9!``Uyˀu:檞U=w-oԺwB}cMK蹰{{=y蹰{{=y蹰{wScaoi'fyO=CyO=Cy[{S=;|v4}ϯ20
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_109_6.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_109_6.dat
new file mode 100644
index 000000000..be7b4749e
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_109_6.dat
@@ -0,0 +1 @@
+xA0~ρDBHCHV20nuol쯯˻=ۢs9[l'?7R"&2:7QqX_n
]$՚EIY*Lq0 0 0{LJз(s\ɳwX-7^ItIII$~?N0 0 0O'Itg7L$L-Iuzrfr
M^'}(O~R]1YLĞu9Qӕ
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_113_6.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_113_6.dat
new file mode 100644
index 000000000..397f52741
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_113_6.dat
@@ -0,0 +1,3 @@
+x E5NՉbF6on,m>gS9RWcǕ9&%1_cx= GR^w-z?dzv=,}ԥ?ǹژ:9m==@U䲉UXUXVe~by4Wi:e=ɼÆ$<>Ov'Cytaaaa~|'9liΣ<<<<Iæ<:<<<ٕWDzy:.z=
ݓʯ
sVöE=ll_k0_#vίmj
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_129_6.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_129_6.dat
new file mode 100644
index 000000000..b4695c3ff
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_129_6.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_133_6.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_133_6.dat
new file mode 100644
index 000000000..40911dc57
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_133_6.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_137_6.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_137_6.dat
new file mode 100644
index 000000000..43ccb68c6
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_137_6.dat
@@ -0,0 +1,2 @@
+x E5?e^4fHp[1-e)UQV]UWN5o*8|۩W6bk?{f|>s֪r666rҟ=vڲWy-'
+Ο;qtQE>U϶f곭xN]Tc(s❮7tAw`v`v`v`kvwfwt;];;;;;!ޙ;ao];l;;;÷|ʷ(3}l.?"މr};\}S-Aw<9;EV'ם
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_141_6.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_141_6.dat
new file mode 100644
index 000000000..0340409a4
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_141_6.dat
@@ -0,0 +1,10 @@
+xa F4/c]زȐ[=[E럓sm,fn/|kj\j?g[q(NOZc5SGGP[oMVָfvL<WóCaz6U~һ{`nݻdvVy~rZ"qk{>g$XKU}m\bjaGx,f1Yb]z̞^.5[?嬜r,f1YY>grVb,f1Y>g,rVmYb,f,|VY9Yb,f,|VY9+g1Ybً ̦M7>2{9z϶hm3l|9xټ#f#x6 -v%N'
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_161_6.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_161_6.dat
new file mode 100644
index 000000000..ecec68b1a
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_161_6.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_165_6.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_165_6.dat
new file mode 100644
index 000000000..d641dfa3d
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_165_6.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_169_6.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_169_6.dat
new file mode 100644
index 000000000..ae689723d
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_169_6.dat
@@ -0,0 +1 @@
+xJ0i9[Jɘk{1b!gnhHkS뉭-V?KIׁ1큏1ƣݎ/`/z)*=3ڏg6^k65CY>㵾+'{է_Vˊx-J<ӛܗr_>>i;rO}/g}g}ٿ}}xO}/g}g}ٷGo/{{r_>>o/z^#}g}ٿd'ʳ|QRNS3YڳZ'msEǷj5
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_173_6.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_173_6.dat
new file mode 100644
index 000000000..95fa97c7b
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_173_6.dat
@@ -0,0 +1 @@
+xa09MrM S*:a_-5hh_)uZ֭[loےsmKN{H?x`l#f9>ڟ[eЄώߓ ?^m*/Kmhy%v-nKlkKL`&& g5(gwxYܞa¬pVcZ[#O=SN9&0 L`DŽ 'tjj]QN9&0 L`sYRc@QN9 L`&0 L`"YRc\ ' r&0 L`EH9AN&0 L`&7p6`|hms
R5Ƙȉ k\X/ )g9
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_177_6.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_177_6.dat
new file mode 100644
index 000000000..e9f0476f0
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_177_6.dat
@@ -0,0 +1,14 @@
+xn {ڤ*4v۴u1{f{_,,K9o 4ǵ7lniJiggir<-MG
+
+
+
+xuV+zRCr9+Gq6QWb"Qe"WL+
+ XXXXX/|~j,nmuMۤ+
+
XXXXXYa,X;M+
+ XXXXXe)oӘf|5H늚7/D
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_21_6.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_21_6.dat
new file mode 100644
index 000000000..6bd505b4a
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_21_6.dat
@@ -0,0 +1 @@
+xڝQ C9M{i]X1-C!D7
Wٜ&rD)~]<M 3(>{AaS
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_25_6.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_25_6.dat
new file mode 100644
index 000000000..d45083aab
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_25_6.dat
@@ -0,0 +1 @@
+xڝQA 52)e+(XmZt*(ڹ;tJ<峂_ڤ3oڴ"̢azh}&qvSG֙,-J4}oS[}w
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_29_6.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_29_6.dat
new file mode 100644
index 000000000..0408e2240
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_29_6.dat
@@ -0,0 +1,3 @@
+xRA
+0XcL(4EԈB
+8CܾnM+lǝՆO1]&ڍ4UD-6-$:6dZ?ylf?
8?߲_ݏ`8G1`B`;+}&s]<iK'l'9%.7
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_65_6.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_65_6.dat
new file mode 100644
index 000000000..550fc8fe7
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_65_6.dat
@@ -0,0 +1 @@
+xWQ i{KNLk?e$Qik41{`+!ڮM
?1b8.^wsnFj5EaQX|=w@2v<ŋŞ|4w\UXBQz+TTcBz/48,5`ȱ OV$
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_69_6.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_69_6.dat
new file mode 100644
index 000000000..a3e4fa0f2
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_69_6.dat
@@ -0,0 +1 @@
+xK @dTh hLSSEq eY@<+*|窮%>z*7e6QS`.>sE'%@[6@P0h
aFxtpl2Q-g1Nfeo^0FdT>N_OwG3ug{3<[Ժb?'6^
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_73_6.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_73_6.dat
new file mode 100644
index 000000000..ab71b70ae
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_73_6.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_77_6.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_77_6.dat
new file mode 100644
index 000000000..ad5a660e3
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_77_6.dat
@@ -0,0 +1 @@
+x E۲iVa.FpSTY4q~z=:͒
6m8:#0PضiDy:2Š'Zs&}滜\r0\ŚXw;iPȔL)Seԕ{hDu9LbJSS))gZ{e)qJdLw+#3-V0շljڠS-S
9=ݯ5PPq1M?g
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_81_6.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_81_6.dat
new file mode 100644
index 000000000..28a6d0752
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_81_6.dat
@@ -0,0 +1,3 @@
+xQ0D9
rRLvk`0 ;i6\|_cc1huio#2}x*.Yt&
+ְq/K;3ve̢ȊAH?`]5Kw!}{Zû߲W
+yⷾ^_ykk^Kתb-bYSڸ'֜Nu#MfHSQ?|]IAiMyyuW
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_85_6.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_85_6.dat
new file mode 100644
index 000000000..d5403e49a
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_85_6.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_89_6.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_89_6.dat
new file mode 100644
index 000000000..eeeb5d197
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_89_6.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_93_6.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_93_6.dat
new file mode 100644
index 000000000..6ff38db68
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_93_6.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_97_6.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_97_6.dat
new file mode 100644
index 000000000..3a2072efd
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_6/mask_97_6.dat
@@ -0,0 +1,2 @@
+xa0sdFx[=4Hoj34&s}*aVc&35arW^aLClzq,1x
SQN]/Giu`&w%,%DY"Kt+HE'|R2(v1vqiqd,%D~%ػJj}ͺĺgY"Kd,+K
+]Wt+sF/)].zN'`>1='#`+bl]Z
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_101_7.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_101_7.dat
new file mode 100644
index 000000000..1f6bc5129
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_101_7.dat
@@ -0,0 +1 @@
+xQ C}rm`fjT#54'tfaЇo$cmOJ23c<6Xn0F
)
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_105_7.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_105_7.dat
new file mode 100644
index 000000000..6b0cacfe9
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_105_7.dat
@@ -0,0 +1,2 @@
+xA
+0EFaMҙNPx)pQ_~|ñ(bF$.aoWGNPUǖM%{oHQUlִL^>+m#{{eo&Y2soM)gncO9sZ3wo+{=f.zޣ{{=zGcskCQϞp^&{^NʷU
e5}EwGn+o
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_109_7.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_109_7.dat
new file mode 100644
index 000000000..9875cbe8c
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_109_7.dat
@@ -0,0 +1,2 @@
+xA
+0D9Mr}*_x-d:"NJ-k"⨚d{ջגɬ|'rQ5+ s)c7-1nn햺qɔJtg^ʉw̘Ň-?*&Mm@ee5^
+c
+
+,b\13j4TZfŢo*
+
+
+:Ut*
+
+
+Xů0"%6ed8rSNsUnk5XejުuVXg,l`u!hXZ\VlM|[ͬ000#hF'c]i>Hataaa~<ÆzyqkO000㪞Faaa)2˰fÒ%z8tO=3=3:cw
+V$
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_121_7.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_121_7.dat
new file mode 100644
index 000000000..d5d577f7e
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_121_7.dat
@@ -0,0 +1,2 @@
+x[
+ Edi;^az,#6ƞ^rh&^amY9_غ5Cr6t^^WlEز~ɿ|MmmS}(
۰
۰
۰}mQ]ZVq]vѲ"M1fG,qBmtaaazeF3cxIDmtaaamný$n۰
۰
۰
ۏa[}`[yޖ)n<4K/Oslnlm/G
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_125_7.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_125_7.dat
new file mode 100644
index 000000000..f9ec0887b
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_125_7.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_129_7.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_129_7.dat
new file mode 100644
index 000000000..9bf51d529
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_129_7.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_133_7.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_133_7.dat
new file mode 100644
index 000000000..b643ffeda
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_133_7.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_137_7.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_137_7.dat
new file mode 100644
index 000000000..11d212bf4
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_137_7.dat
@@ -0,0 +1,5 @@
+x
+ F4/
c_ǂ+{SK<o[l
+Ο
+07։Vl;b7fMS;1LCvR|KMH
+#Н(Sqd
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_141_7.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_141_7.dat
new file mode 100644
index 000000000..98dffab00
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_141_7.dat
@@ -0,0 +1 @@
+xA E=
rITY@Ä0!|1tbG0ԗѤs2Z/oa\qzOnҋMntX"KmeM}CpPL^S0S0S0SL )ǔژY߾%b,Sl?zC)tLLLLI2zRXh@)tLLLLI1zbϷB)~0S0S0S07)|B)))3ՖL%tfwM*:~hZsnc$1UTtJg8OYE
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_145_7.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_145_7.dat
new file mode 100644
index 000000000..4aa2bac11
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_145_7.dat
@@ -0,0 +1,2 @@
+x
+ E5?W6Z-^2qbGX6(Ɖu"LbbGuμGk:HwA[jmHݞ3OkQ{l|TEmJfL?2"&)kRfc̉F,z=5X5X5X7F\pUs#5X5X5XFdYk!a
`
`
`o8ct
]CC
gM5[N%khZp?Iܣϲ^n$Y7AZP[
fȓ0
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_149_7.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_149_7.dat
new file mode 100644
index 000000000..809f00554
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_149_7.dat
@@ -0,0 +1 @@
+xn {?
uچ2G$ncFKb3֪tPc̥7[?9:['9'*ӖGah_/z+6XB>2qYJ0黏Bfa 19c7G Ol,^꽓3A:H 1Ab0X4%٫#d>&C 1Ab+g嬜,f1Yb|Y>+g嬜,f1Ylio.\Ɲo=gϙ-yk_TA
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_161_7.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_161_7.dat
new file mode 100644
index 000000000..35ba8ff48
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_161_7.dat
@@ -0,0 +1 @@
+xю y/皨E)Ʈ1~493,˵+ZT=ZeC.~iߏ&>,6e~,lW]
2\;2j"e,rXݵV(c쵵ZӖ18ީ/,'t.ee,cX2߱,_|yt|]t.cX2e,cy/ɗys.eLe,cX2lo|Z{+2]bl,cX2e{+֊[A2]X2e,c9CX;QIQH8R҈G"z,&;'o97%P8%6oǽ;]NWn[f7v
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_29_7.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_29_7.dat
new file mode 100644
index 000000000..e3d7391b7
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_29_7.dat
@@ -0,0 +1,2 @@
+xR9 QpX$lŲf!I2pgSMZj"te0#ԛ`_1-cha~/Eh4"~
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_37_7.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_37_7.dat
new file mode 100644
index 000000000..87d9a1a9d
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_37_7.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_41_7.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_41_7.dat
new file mode 100644
index 000000000..8acec04f0
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_41_7.dat
@@ -0,0 +1 @@
+xTA 5[fDY(O^bR3/~t/L"7SQQ5j\Sib#Նȏ+ǣw#zx?㽧A-wu曑Y7$b.%A;wRoxG}?
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_45_7.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_45_7.dat
new file mode 100644
index 000000000..dbba31d0b
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_45_7.dat differ
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_49_7.dat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_49_7.dat
new file mode 100644
index 000000000..be5dce8b7
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/cache/mask_7/mask_49_7.dat
@@ -0,0 +1 @@
+xV0khC-X.ukv
o40T%96U5*sI{`_>S?}(:yTl{G&E\6}"AXXϬ
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/phpqrcode.php b/niucloud/vendor/kkokk/poster/src/PHPQrcode/phpqrcode.php
new file mode 100644
index 000000000..fd4f0d1d7
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/phpqrcode.php
@@ -0,0 +1,3351 @@
+
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+
+/*
+ * Version: 1.1.4
+ * Build: 2010100721
+ */
+
+
+
+//---- qrconst.php -----------------------------
+
+
+
+
+
+/*
+ * PHP QR Code encoder
+ *
+ * Common constants
+ *
+ * Based on libqrencode C library distributed under LGPL 2.1
+ * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+ // Encoding modes
+ if(!defined('QR_MODE_NUL')) define('QR_MODE_NUL', -1);
+ if(!defined('QR_MODE_NUM')) define('QR_MODE_NUM', 0);
+ define('QR_MODE_AN', 1);
+ define('QR_MODE_8', 2);
+ define('QR_MODE_KANJI', 3);
+ define('QR_MODE_STRUCTURE', 4);
+
+ // Levels of error correction.
+
+ define('QR_ECLEVEL_L', 0);
+ define('QR_ECLEVEL_M', 1);
+ define('QR_ECLEVEL_Q', 2);
+ define('QR_ECLEVEL_H', 3);
+
+ // Supported output formats
+
+ define('QR_FORMAT_TEXT', 0);
+ define('QR_FORMAT_PNG', 1);
+
+ class qrstr {
+ public static function set(&$srctab, $x, $y, $repl, $replLen = false) {
+ $srctab[$y] = substr_replace($srctab[$y], ($replLen !== false)?substr($repl,0,$replLen):$repl, $x, ($replLen !== false)?$replLen:strlen($repl));
+ }
+ }
+
+
+
+//---- merged_config.php -----------------------------
+
+
+
+
+/*
+ * PHP QR Code encoder
+ *
+ * Config file, tuned-up for merged verion
+ */
+
+ define('QR_CACHEABLE', false); // use cache - more disk reads but less CPU power, masks and format templates are stored there
+ define('QR_CACHE_DIR', false); // used when QR_CACHEABLE === true
+ define('QR_LOG_DIR', false); // default error logs dir
+
+ define('QR_FIND_BEST_MASK', true); // if true, estimates best mask (spec. default, but extremally slow; set to false to significant performance boost but (propably) worst quality code
+ define('QR_FIND_FROM_RANDOM', 2); // if false, checks all masks available, otherwise value tells count of masks need to be checked, mask id are got randomly
+ define('QR_DEFAULT_MASK', 2); // when QR_FIND_BEST_MASK === false
+
+ define('QR_PNG_MAXIMUM_SIZE', 1024); // maximum allowed png image width (in pixels), tune to make sure GD and PHP can handle such big images
+
+
+
+
+//---- qrtools.php -----------------------------
+
+
+
+
+/*
+ * PHP QR Code encoder
+ *
+ * Toolset, handy and debug utilites.
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+ class QRtools {
+
+ //----------------------------------------------------------------------
+ public static function binarize($frame)
+ {
+ $len = count($frame);
+ foreach ($frame as &$frameLine) {
+
+ for($i=0; $i<$len; $i++) {
+ $frameLine[$i] = (ord($frameLine[$i])&1)?'1':'0';
+ }
+ }
+
+ return $frame;
+ }
+
+ //----------------------------------------------------------------------
+ public static function tcpdfBarcodeArray($code, $mode = 'QR,L', $tcPdfVersion = '4.5.037')
+ {
+ $barcode_array = array();
+
+ if (!is_array($mode))
+ $mode = explode(',', $mode);
+
+ $eccLevel = 'L';
+
+ if (count($mode) > 1) {
+ $eccLevel = $mode[1];
+ }
+
+ $qrTab = QRcode::text($code, false, $eccLevel);
+ $size = count($qrTab);
+
+ $barcode_array['num_rows'] = $size;
+ $barcode_array['num_cols'] = $size;
+ $barcode_array['bcode'] = array();
+
+ foreach ($qrTab as $line) {
+ $arrAdd = array();
+ foreach(str_split($line) as $char)
+ $arrAdd[] = ($char=='1')?1:0;
+ $barcode_array['bcode'][] = $arrAdd;
+ }
+
+ return $barcode_array;
+ }
+
+ //----------------------------------------------------------------------
+ public static function clearCache()
+ {
+ self::$frames = array();
+ }
+
+ //----------------------------------------------------------------------
+ public static function buildCache()
+ {
+ QRtools::markTime('before_build_cache');
+
+ $mask = new QRmask();
+ for ($a=1; $a <= QRSPEC_VERSION_MAX; $a++) {
+ $frame = QRspec::newFrame($a);
+ if (QR_IMAGE) {
+ $fileName = QR_CACHE_DIR.'frame_'.$a.'.png';
+ QRimage::png(self::binarize($frame), $fileName, 1, 0);
+ }
+
+ $width = count($frame);
+ $bitMask = array_fill(0, $width, array_fill(0, $width, 0));
+ for ($maskNo=0; $maskNo<8; $maskNo++)
+ $mask->makeMaskNo($maskNo, $width, $frame, $bitMask, true);
+ }
+
+ QRtools::markTime('after_build_cache');
+ }
+
+ //----------------------------------------------------------------------
+ public static function log($outfile, $err)
+ {
+ if (QR_LOG_DIR !== false) {
+ if ($err != '') {
+ if ($outfile !== false) {
+ file_put_contents(QR_LOG_DIR.basename($outfile).'-errors.txt', date('Y-m-d H:i:s').': '.$err, FILE_APPEND);
+ } else {
+ file_put_contents(QR_LOG_DIR.'errors.txt', date('Y-m-d H:i:s').': '.$err, FILE_APPEND);
+ }
+ }
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public static function dumpMask($frame)
+ {
+ $width = count($frame);
+ for($y=0;$y<$width;$y++) {
+ for($x=0;$x<$width;$x++) {
+ echo ord($frame[$y][$x]).',';
+ }
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public static function markTime($markerId)
+ {
+ list($usec, $sec) = explode(" ", microtime());
+ $time = ((float)$usec + (float)$sec);
+
+ if (!isset($GLOBALS['qr_time_bench']))
+ $GLOBALS['qr_time_bench'] = array();
+
+ $GLOBALS['qr_time_bench'][$markerId] = $time;
+ }
+
+ //----------------------------------------------------------------------
+ public static function timeBenchmark()
+ {
+ self::markTime('finish');
+
+ $lastTime = 0;
+ $startTime = 0;
+ $p = 0;
+
+ echo '
+ | BENCHMARK |
+ ';
+
+ foreach($GLOBALS['qr_time_bench'] as $markerId=>$thisTime) {
+ if ($p > 0) {
+ echo '| till '.$markerId.': | '.number_format($thisTime-$lastTime, 6).'s |
';
+ } else {
+ $startTime = $thisTime;
+ }
+
+ $p++;
+ $lastTime = $thisTime;
+ }
+
+ echo '
+ | TOTAL: | '.number_format($lastTime-$startTime, 6).'s |
+
+
';
+ }
+
+ }
+
+ //##########################################################################
+
+ QRtools::markTime('start');
+
+
+
+
+//---- qrspec.php -----------------------------
+
+
+
+
+/*
+ * PHP QR Code encoder
+ *
+ * QR Code specifications
+ *
+ * Based on libqrencode C library distributed under LGPL 2.1
+ * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia
+ *
+ * The following data / specifications are taken from
+ * "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004)
+ * or
+ * "Automatic identification and data capture techniques --
+ * QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+ define('QRSPEC_VERSION_MAX', 40);
+ define('QRSPEC_WIDTH_MAX', 177);
+
+ define('QRCAP_WIDTH', 0);
+ define('QRCAP_WORDS', 1);
+ define('QRCAP_REMINDER', 2);
+ define('QRCAP_EC', 3);
+
+ class QRspec {
+
+ public static $capacity = array(
+ array( 0, 0, 0, array( 0, 0, 0, 0)),
+ array( 21, 26, 0, array( 7, 10, 13, 17)), // 1
+ array( 25, 44, 7, array( 10, 16, 22, 28)),
+ array( 29, 70, 7, array( 15, 26, 36, 44)),
+ array( 33, 100, 7, array( 20, 36, 52, 64)),
+ array( 37, 134, 7, array( 26, 48, 72, 88)), // 5
+ array( 41, 172, 7, array( 36, 64, 96, 112)),
+ array( 45, 196, 0, array( 40, 72, 108, 130)),
+ array( 49, 242, 0, array( 48, 88, 132, 156)),
+ array( 53, 292, 0, array( 60, 110, 160, 192)),
+ array( 57, 346, 0, array( 72, 130, 192, 224)), //10
+ array( 61, 404, 0, array( 80, 150, 224, 264)),
+ array( 65, 466, 0, array( 96, 176, 260, 308)),
+ array( 69, 532, 0, array( 104, 198, 288, 352)),
+ array( 73, 581, 3, array( 120, 216, 320, 384)),
+ array( 77, 655, 3, array( 132, 240, 360, 432)), //15
+ array( 81, 733, 3, array( 144, 280, 408, 480)),
+ array( 85, 815, 3, array( 168, 308, 448, 532)),
+ array( 89, 901, 3, array( 180, 338, 504, 588)),
+ array( 93, 991, 3, array( 196, 364, 546, 650)),
+ array( 97, 1085, 3, array( 224, 416, 600, 700)), //20
+ array(101, 1156, 4, array( 224, 442, 644, 750)),
+ array(105, 1258, 4, array( 252, 476, 690, 816)),
+ array(109, 1364, 4, array( 270, 504, 750, 900)),
+ array(113, 1474, 4, array( 300, 560, 810, 960)),
+ array(117, 1588, 4, array( 312, 588, 870, 1050)), //25
+ array(121, 1706, 4, array( 336, 644, 952, 1110)),
+ array(125, 1828, 4, array( 360, 700, 1020, 1200)),
+ array(129, 1921, 3, array( 390, 728, 1050, 1260)),
+ array(133, 2051, 3, array( 420, 784, 1140, 1350)),
+ array(137, 2185, 3, array( 450, 812, 1200, 1440)), //30
+ array(141, 2323, 3, array( 480, 868, 1290, 1530)),
+ array(145, 2465, 3, array( 510, 924, 1350, 1620)),
+ array(149, 2611, 3, array( 540, 980, 1440, 1710)),
+ array(153, 2761, 3, array( 570, 1036, 1530, 1800)),
+ array(157, 2876, 0, array( 570, 1064, 1590, 1890)), //35
+ array(161, 3034, 0, array( 600, 1120, 1680, 1980)),
+ array(165, 3196, 0, array( 630, 1204, 1770, 2100)),
+ array(169, 3362, 0, array( 660, 1260, 1860, 2220)),
+ array(173, 3532, 0, array( 720, 1316, 1950, 2310)),
+ array(177, 3706, 0, array( 750, 1372, 2040, 2430)) //40
+ );
+
+ //----------------------------------------------------------------------
+ public static function getDataLength($version, $level)
+ {
+ return self::$capacity[$version][QRCAP_WORDS] - self::$capacity[$version][QRCAP_EC][$level];
+ }
+
+ //----------------------------------------------------------------------
+ public static function getECCLength($version, $level)
+ {
+ return self::$capacity[$version][QRCAP_EC][$level];
+ }
+
+ //----------------------------------------------------------------------
+ public static function getWidth($version)
+ {
+ return self::$capacity[$version][QRCAP_WIDTH];
+ }
+
+ //----------------------------------------------------------------------
+ public static function getRemainder($version)
+ {
+ return self::$capacity[$version][QRCAP_REMINDER];
+ }
+
+ //----------------------------------------------------------------------
+ public static function getMinimumVersion($size, $level)
+ {
+
+ for($i=1; $i<= QRSPEC_VERSION_MAX; $i++) {
+ $words = self::$capacity[$i][QRCAP_WORDS] - self::$capacity[$i][QRCAP_EC][$level];
+ if($words >= $size)
+ return $i;
+ }
+
+ return -1;
+ }
+
+ //######################################################################
+
+ public static $lengthTableBits = array(
+ array(10, 12, 14),
+ array( 9, 11, 13),
+ array( 8, 16, 16),
+ array( 8, 10, 12)
+ );
+
+ //----------------------------------------------------------------------
+ public static function lengthIndicator($mode, $version)
+ {
+ if ($mode == QR_MODE_STRUCTURE)
+ return 0;
+
+ if ($version <= 9) {
+ $l = 0;
+ } else if ($version <= 26) {
+ $l = 1;
+ } else {
+ $l = 2;
+ }
+
+ return self::$lengthTableBits[$mode][$l];
+ }
+
+ //----------------------------------------------------------------------
+ public static function maximumWords($mode, $version)
+ {
+ if($mode == QR_MODE_STRUCTURE)
+ return 3;
+
+ if($version <= 9) {
+ $l = 0;
+ } else if($version <= 26) {
+ $l = 1;
+ } else {
+ $l = 2;
+ }
+
+ $bits = self::$lengthTableBits[$mode][$l];
+ $words = (1 << $bits) - 1;
+
+ if($mode == QR_MODE_KANJI) {
+ $words *= 2; // the number of bytes is required
+ }
+
+ return $words;
+ }
+
+ // Error correction code -----------------------------------------------
+ // Table of the error correction code (Reed-Solomon block)
+ // See Table 12-16 (pp.30-36), JIS X0510:2004.
+
+ public static $eccTable = array(
+ array(array( 0, 0), array( 0, 0), array( 0, 0), array( 0, 0)),
+ array(array( 1, 0), array( 1, 0), array( 1, 0), array( 1, 0)), // 1
+ array(array( 1, 0), array( 1, 0), array( 1, 0), array( 1, 0)),
+ array(array( 1, 0), array( 1, 0), array( 2, 0), array( 2, 0)),
+ array(array( 1, 0), array( 2, 0), array( 2, 0), array( 4, 0)),
+ array(array( 1, 0), array( 2, 0), array( 2, 2), array( 2, 2)), // 5
+ array(array( 2, 0), array( 4, 0), array( 4, 0), array( 4, 0)),
+ array(array( 2, 0), array( 4, 0), array( 2, 4), array( 4, 1)),
+ array(array( 2, 0), array( 2, 2), array( 4, 2), array( 4, 2)),
+ array(array( 2, 0), array( 3, 2), array( 4, 4), array( 4, 4)),
+ array(array( 2, 2), array( 4, 1), array( 6, 2), array( 6, 2)), //10
+ array(array( 4, 0), array( 1, 4), array( 4, 4), array( 3, 8)),
+ array(array( 2, 2), array( 6, 2), array( 4, 6), array( 7, 4)),
+ array(array( 4, 0), array( 8, 1), array( 8, 4), array(12, 4)),
+ array(array( 3, 1), array( 4, 5), array(11, 5), array(11, 5)),
+ array(array( 5, 1), array( 5, 5), array( 5, 7), array(11, 7)), //15
+ array(array( 5, 1), array( 7, 3), array(15, 2), array( 3, 13)),
+ array(array( 1, 5), array(10, 1), array( 1, 15), array( 2, 17)),
+ array(array( 5, 1), array( 9, 4), array(17, 1), array( 2, 19)),
+ array(array( 3, 4), array( 3, 11), array(17, 4), array( 9, 16)),
+ array(array( 3, 5), array( 3, 13), array(15, 5), array(15, 10)), //20
+ array(array( 4, 4), array(17, 0), array(17, 6), array(19, 6)),
+ array(array( 2, 7), array(17, 0), array( 7, 16), array(34, 0)),
+ array(array( 4, 5), array( 4, 14), array(11, 14), array(16, 14)),
+ array(array( 6, 4), array( 6, 14), array(11, 16), array(30, 2)),
+ array(array( 8, 4), array( 8, 13), array( 7, 22), array(22, 13)), //25
+ array(array(10, 2), array(19, 4), array(28, 6), array(33, 4)),
+ array(array( 8, 4), array(22, 3), array( 8, 26), array(12, 28)),
+ array(array( 3, 10), array( 3, 23), array( 4, 31), array(11, 31)),
+ array(array( 7, 7), array(21, 7), array( 1, 37), array(19, 26)),
+ array(array( 5, 10), array(19, 10), array(15, 25), array(23, 25)), //30
+ array(array(13, 3), array( 2, 29), array(42, 1), array(23, 28)),
+ array(array(17, 0), array(10, 23), array(10, 35), array(19, 35)),
+ array(array(17, 1), array(14, 21), array(29, 19), array(11, 46)),
+ array(array(13, 6), array(14, 23), array(44, 7), array(59, 1)),
+ array(array(12, 7), array(12, 26), array(39, 14), array(22, 41)), //35
+ array(array( 6, 14), array( 6, 34), array(46, 10), array( 2, 64)),
+ array(array(17, 4), array(29, 14), array(49, 10), array(24, 46)),
+ array(array( 4, 18), array(13, 32), array(48, 14), array(42, 32)),
+ array(array(20, 4), array(40, 7), array(43, 22), array(10, 67)),
+ array(array(19, 6), array(18, 31), array(34, 34), array(20, 61)),//40
+ );
+
+ //----------------------------------------------------------------------
+ // CACHEABLE!!!
+
+ public static function getEccSpec($version, $level, array &$spec)
+ {
+ if (count($spec) < 5) {
+ $spec = array(0,0,0,0,0);
+ }
+
+ $b1 = self::$eccTable[$version][$level][0];
+ $b2 = self::$eccTable[$version][$level][1];
+ $data = self::getDataLength($version, $level);
+ $ecc = self::getECCLength($version, $level);
+
+ if($b2 == 0) {
+ $spec[0] = $b1;
+ $spec[1] = (int)($data / $b1);
+ $spec[2] = (int)($ecc / $b1);
+ $spec[3] = 0;
+ $spec[4] = 0;
+ } else {
+ $spec[0] = $b1;
+ $spec[1] = (int)($data / ($b1 + $b2));
+ $spec[2] = (int)($ecc / ($b1 + $b2));
+ $spec[3] = $b2;
+ $spec[4] = $spec[1] + 1;
+ }
+ }
+
+ // Alignment pattern ---------------------------------------------------
+
+ // Positions of alignment patterns.
+ // This array includes only the second and the third position of the
+ // alignment patterns. Rest of them can be calculated from the distance
+ // between them.
+
+ // See Table 1 in Appendix E (pp.71) of JIS X0510:2004.
+
+ public static $alignmentPattern = array(
+ array( 0, 0),
+ array( 0, 0), array(18, 0), array(22, 0), array(26, 0), array(30, 0), // 1- 5
+ array(34, 0), array(22, 38), array(24, 42), array(26, 46), array(28, 50), // 6-10
+ array(30, 54), array(32, 58), array(34, 62), array(26, 46), array(26, 48), //11-15
+ array(26, 50), array(30, 54), array(30, 56), array(30, 58), array(34, 62), //16-20
+ array(28, 50), array(26, 50), array(30, 54), array(28, 54), array(32, 58), //21-25
+ array(30, 58), array(34, 62), array(26, 50), array(30, 54), array(26, 52), //26-30
+ array(30, 56), array(34, 60), array(30, 58), array(34, 62), array(30, 54), //31-35
+ array(24, 50), array(28, 54), array(32, 58), array(26, 54), array(30, 58), //35-40
+ );
+
+
+ /** --------------------------------------------------------------------
+ * Put an alignment marker.
+ * @param frame
+ * @param width
+ * @param ox,oy center coordinate of the pattern
+ */
+ public static function putAlignmentMarker(array &$frame, $ox, $oy)
+ {
+ $finder = array(
+ "\xa1\xa1\xa1\xa1\xa1",
+ "\xa1\xa0\xa0\xa0\xa1",
+ "\xa1\xa0\xa1\xa0\xa1",
+ "\xa1\xa0\xa0\xa0\xa1",
+ "\xa1\xa1\xa1\xa1\xa1"
+ );
+
+ $yStart = $oy-2;
+ $xStart = $ox-2;
+
+ for($y=0; $y<5; $y++) {
+ QRstr::set($frame, $xStart, $yStart+$y, $finder[$y]);
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public static function putAlignmentPattern($version, &$frame, $width)
+ {
+ if($version < 2)
+ return;
+
+ $d = self::$alignmentPattern[$version][1] - self::$alignmentPattern[$version][0];
+ if($d < 0) {
+ $w = 2;
+ } else {
+ $w = (int)(($width - self::$alignmentPattern[$version][0]) / $d + 2);
+ }
+
+ if($w * $w - 3 == 1) {
+ $x = self::$alignmentPattern[$version][0];
+ $y = self::$alignmentPattern[$version][0];
+ self::putAlignmentMarker($frame, $x, $y);
+ return;
+ }
+
+ $cx = self::$alignmentPattern[$version][0];
+ for($x=1; $x<$w - 1; $x++) {
+ self::putAlignmentMarker($frame, 6, $cx);
+ self::putAlignmentMarker($frame, $cx, 6);
+ $cx += $d;
+ }
+
+ $cy = self::$alignmentPattern[$version][0];
+ for($y=0; $y<$w-1; $y++) {
+ $cx = self::$alignmentPattern[$version][0];
+ for($x=0; $x<$w-1; $x++) {
+ self::putAlignmentMarker($frame, $cx, $cy);
+ $cx += $d;
+ }
+ $cy += $d;
+ }
+ }
+
+ // Version information pattern -----------------------------------------
+
+ // Version information pattern (BCH coded).
+ // See Table 1 in Appendix D (pp.68) of JIS X0510:2004.
+
+ // size: [QRSPEC_VERSION_MAX - 6]
+
+ public static $versionPattern = array(
+ 0x07c94, 0x085bc, 0x09a99, 0x0a4d3, 0x0bbf6, 0x0c762, 0x0d847, 0x0e60d,
+ 0x0f928, 0x10b78, 0x1145d, 0x12a17, 0x13532, 0x149a6, 0x15683, 0x168c9,
+ 0x177ec, 0x18ec4, 0x191e1, 0x1afab, 0x1b08e, 0x1cc1a, 0x1d33f, 0x1ed75,
+ 0x1f250, 0x209d5, 0x216f0, 0x228ba, 0x2379f, 0x24b0b, 0x2542e, 0x26a64,
+ 0x27541, 0x28c69
+ );
+
+ //----------------------------------------------------------------------
+ public static function getVersionPattern($version)
+ {
+ if($version < 7 || $version > QRSPEC_VERSION_MAX)
+ return 0;
+
+ return self::$versionPattern[$version -7];
+ }
+
+ // Format information --------------------------------------------------
+ // See calcFormatInfo in tests/test_qrspec.c (orginal qrencode c lib)
+
+ public static $formatInfo = array(
+ array(0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976),
+ array(0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0),
+ array(0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed),
+ array(0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b)
+ );
+
+ public static function getFormatInfo($mask, $level)
+ {
+ if($mask < 0 || $mask > 7)
+ return 0;
+
+ if($level < 0 || $level > 3)
+ return 0;
+
+ return self::$formatInfo[$level][$mask];
+ }
+
+ // Frame ---------------------------------------------------------------
+ // Cache of initial frames.
+
+ public static $frames = array();
+
+ /** --------------------------------------------------------------------
+ * Put a finder pattern.
+ * @param frame
+ * @param width
+ * @param ox,oy upper-left coordinate of the pattern
+ */
+ public static function putFinderPattern(&$frame, $ox, $oy)
+ {
+ $finder = array(
+ "\xc1\xc1\xc1\xc1\xc1\xc1\xc1",
+ "\xc1\xc0\xc0\xc0\xc0\xc0\xc1",
+ "\xc1\xc0\xc1\xc1\xc1\xc0\xc1",
+ "\xc1\xc0\xc1\xc1\xc1\xc0\xc1",
+ "\xc1\xc0\xc1\xc1\xc1\xc0\xc1",
+ "\xc1\xc0\xc0\xc0\xc0\xc0\xc1",
+ "\xc1\xc1\xc1\xc1\xc1\xc1\xc1"
+ );
+
+ for($y=0; $y<7; $y++) {
+ QRstr::set($frame, $ox, $oy+$y, $finder[$y]);
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public static function createFrame($version)
+ {
+ $width = self::$capacity[$version][QRCAP_WIDTH];
+ $frameLine = str_repeat ("\0", $width);
+ $frame = array_fill(0, $width, $frameLine);
+
+ // Finder pattern
+ self::putFinderPattern($frame, 0, 0);
+ self::putFinderPattern($frame, $width - 7, 0);
+ self::putFinderPattern($frame, 0, $width - 7);
+
+ // Separator
+ $yOffset = $width - 7;
+
+ for($y=0; $y<7; $y++) {
+ $frame[$y][7] = "\xc0";
+ $frame[$y][$width - 8] = "\xc0";
+ $frame[$yOffset][7] = "\xc0";
+ $yOffset++;
+ }
+
+ $setPattern = str_repeat("\xc0", 8);
+
+ QRstr::set($frame, 0, 7, $setPattern);
+ QRstr::set($frame, $width-8, 7, $setPattern);
+ QRstr::set($frame, 0, $width - 8, $setPattern);
+
+ // Format info
+ $setPattern = str_repeat("\x84", 9);
+ QRstr::set($frame, 0, 8, $setPattern);
+ QRstr::set($frame, $width - 8, 8, $setPattern, 8);
+
+ $yOffset = $width - 8;
+
+ for($y=0; $y<8; $y++,$yOffset++) {
+ $frame[$y][8] = "\x84";
+ $frame[$yOffset][8] = "\x84";
+ }
+
+ // Timing pattern
+
+ for($i=1; $i<$width-15; $i++) {
+ $frame[6][7+$i] = chr(0x90 | ($i & 1));
+ $frame[7+$i][6] = chr(0x90 | ($i & 1));
+ }
+
+ // Alignment pattern
+ self::putAlignmentPattern($version, $frame, $width);
+
+ // Version information
+ if($version >= 7) {
+ $vinf = self::getVersionPattern($version);
+
+ $v = $vinf;
+
+ for($x=0; $x<6; $x++) {
+ for($y=0; $y<3; $y++) {
+ $frame[($width - 11)+$y][$x] = chr(0x88 | ($v & 1));
+ $v = $v >> 1;
+ }
+ }
+
+ $v = $vinf;
+ for($y=0; $y<6; $y++) {
+ for($x=0; $x<3; $x++) {
+ $frame[$y][$x+($width - 11)] = chr(0x88 | ($v & 1));
+ $v = $v >> 1;
+ }
+ }
+ }
+
+ // and a little bit...
+ $frame[$width - 8][8] = "\x81";
+
+ return $frame;
+ }
+
+ //----------------------------------------------------------------------
+ public static function debug($frame, $binary_mode = false)
+ {
+ if ($binary_mode) {
+
+ foreach ($frame as &$frameLine) {
+ $frameLine = join(' ', explode('0', $frameLine));
+ $frameLine = join('██', explode('1', $frameLine));
+ }
+
+ ?>
+
+
';
+ echo join("
", $frame);
+ echo '
';
+
+ } else {
+
+ foreach ($frame as &$frameLine) {
+ $frameLine = join(' ', explode("\xc0", $frameLine));
+ $frameLine = join('▒', explode("\xc1", $frameLine));
+ $frameLine = join(' ', explode("\xa0", $frameLine));
+ $frameLine = join('▒', explode("\xa1", $frameLine));
+ $frameLine = join('◇', explode("\x84", $frameLine)); //format 0
+ $frameLine = join('◆', explode("\x85", $frameLine)); //format 1
+ $frameLine = join('☢', explode("\x81", $frameLine)); //special bit
+ $frameLine = join(' ', explode("\x90", $frameLine)); //clock 0
+ $frameLine = join('◷', explode("\x91", $frameLine)); //clock 1
+ $frameLine = join(' ', explode("\x88", $frameLine)); //version
+ $frameLine = join('▒', explode("\x89", $frameLine)); //version
+ $frameLine = join('♦', explode("\x01", $frameLine));
+ $frameLine = join('⋅', explode("\0", $frameLine));
+ }
+
+ ?>
+
+ ";
+ echo join("
", $frame);
+ echo "";
+
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public static function serial($frame)
+ {
+ return gzcompress(join("\n", $frame), 9);
+ }
+
+ //----------------------------------------------------------------------
+ public static function unserial($code)
+ {
+ return explode("\n", gzuncompress($code));
+ }
+
+ //----------------------------------------------------------------------
+ public static function newFrame($version)
+ {
+ if($version < 1 || $version > QRSPEC_VERSION_MAX)
+ return null;
+
+ if(!isset(self::$frames[$version])) {
+
+ $fileName = QR_CACHE_DIR.'frame_'.$version.'.dat';
+
+ if (QR_CACHEABLE) {
+ if (file_exists($fileName)) {
+ self::$frames[$version] = self::unserial(file_get_contents($fileName));
+ } else {
+ self::$frames[$version] = self::createFrame($version);
+ file_put_contents($fileName, self::serial(self::$frames[$version]));
+ }
+ } else {
+ self::$frames[$version] = self::createFrame($version);
+ }
+ }
+
+ if(is_null(self::$frames[$version]))
+ return null;
+
+ return self::$frames[$version];
+ }
+
+ //----------------------------------------------------------------------
+ public static function rsBlockNum($spec) { return $spec[0] + $spec[3]; }
+ public static function rsBlockNum1($spec) { return $spec[0]; }
+ public static function rsDataCodes1($spec) { return $spec[1]; }
+ public static function rsEccCodes1($spec) { return $spec[2]; }
+ public static function rsBlockNum2($spec) { return $spec[3]; }
+ public static function rsDataCodes2($spec) { return $spec[4]; }
+ public static function rsEccCodes2($spec) { return $spec[2]; }
+ public static function rsDataLength($spec) { return ($spec[0] * $spec[1]) + ($spec[3] * $spec[4]); }
+ public static function rsEccLength($spec) { return ($spec[0] + $spec[3]) * $spec[2]; }
+
+ }
+
+
+
+//---- qrimage.php -----------------------------
+
+
+
+
+/*
+ * PHP QR Code encoder
+ *
+ * Image output of code using GD2
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+ define('QR_IMAGE', true);
+
+ class QRimage {
+
+ //----------------------------------------------------------------------
+ public static function png($frame, $filename = false, $pixelPerPoint = 4, $outerFrame = 4,$saveAndPrint=FALSE)
+ {
+ $image = self::image($frame, $pixelPerPoint, $outerFrame);
+
+ if ($filename === false) {
+ Header("Content-type: image/png");
+ ImagePng($image);
+ } else {
+ if($saveAndPrint===TRUE){
+ ImagePng($image, $filename);
+ header("Content-type: image/png");
+ ImagePng($image);
+ }else{
+ ImagePng($image, $filename);
+ }
+ }
+
+ ImageDestroy($image);
+ }
+
+ # 自加方法
+ public static function re_png($frame, $pixelPerPoint = 4, $outerFrame = 4)
+ {
+ $image = self::image($frame, $pixelPerPoint, $outerFrame);
+
+ return $image;
+ }
+
+ //----------------------------------------------------------------------
+ public static function jpg($frame, $filename = false, $pixelPerPoint = 8, $outerFrame = 4, $q = 85)
+ {
+ $image = self::image($frame, $pixelPerPoint, $outerFrame);
+
+ if ($filename === false) {
+ Header("Content-type: image/jpeg");
+ ImageJpeg($image, null, $q);
+ } else {
+ ImageJpeg($image, $filename, $q);
+ }
+
+ ImageDestroy($image);
+ }
+
+ //----------------------------------------------------------------------
+ private static function image($frame, $pixelPerPoint = 4, $outerFrame = 4)
+ {
+ $h = count($frame);
+ $w = strlen($frame[0]);
+
+ $imgW = $w + 2*$outerFrame;
+ $imgH = $h + 2*$outerFrame;
+
+ $base_image =ImageCreate($imgW, $imgH);
+
+ $col[0] = ImageColorAllocate($base_image,255,255,255);
+ $col[1] = ImageColorAllocate($base_image,0,0,0);
+
+ imagefill($base_image, 0, 0, $col[0]);
+
+ for($y=0; $y<$h; $y++) {
+ for($x=0; $x<$w; $x++) {
+ if ($frame[$y][$x] == '1') {
+ ImageSetPixel($base_image,$x+$outerFrame,$y+$outerFrame,$col[1]);
+ }
+ }
+ }
+
+ $target_image =ImageCreate($imgW * $pixelPerPoint, $imgH * $pixelPerPoint);
+ ImageCopyResized($target_image, $base_image, 0, 0, 0, 0, $imgW * $pixelPerPoint, $imgH * $pixelPerPoint, $imgW, $imgH);
+ ImageDestroy($base_image);
+
+ return $target_image;
+ }
+ }
+
+
+
+//---- qrinput.php -----------------------------
+
+
+
+
+/*
+ * PHP QR Code encoder
+ *
+ * InputGenerator encoding class
+ *
+ * Based on libqrencode C library distributed under LGPL 2.1
+ * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+ define('STRUCTURE_HEADER_BITS', 20);
+ define('MAX_STRUCTURED_SYMBOLS', 16);
+
+ class QRinputItem {
+
+ public $mode;
+ public $size;
+ public $data;
+ public $bstream;
+
+ public function __construct($mode, $size, $data, $bstream = null)
+ {
+ $setData = array_slice($data, 0, $size);
+
+ if (count($setData) < $size) {
+ $setData = array_merge($setData, array_fill(0,$size-count($setData),0));
+ }
+
+ if(!QRinput::check($mode, $size, $setData)) {
+ throw new Exception('Error m:'.$mode.',s:'.$size.',d:'.join(',',$setData));
+ return null;
+ }
+
+ $this->mode = $mode;
+ $this->size = $size;
+ $this->data = $setData;
+ $this->bstream = $bstream;
+ }
+
+ //----------------------------------------------------------------------
+ public function encodeModeNum($version)
+ {
+ try {
+
+ $words = (int)($this->size / 3);
+ $bs = new QRbitstream();
+
+ $val = 0x1;
+ $bs->appendNum(4, $val);
+ $bs->appendNum(QRspec::lengthIndicator(QR_MODE_NUM, $version), $this->size);
+
+ for($i=0; $i<$words; $i++) {
+ $val = (ord($this->data[$i*3 ]) - ord('0')) * 100;
+ $val += (ord($this->data[$i*3+1]) - ord('0')) * 10;
+ $val += (ord($this->data[$i*3+2]) - ord('0'));
+ $bs->appendNum(10, $val);
+ }
+
+ if($this->size - $words * 3 == 1) {
+ $val = ord($this->data[$words*3]) - ord('0');
+ $bs->appendNum(4, $val);
+ } else if($this->size - $words * 3 == 2) {
+ $val = (ord($this->data[$words*3 ]) - ord('0')) * 10;
+ $val += (ord($this->data[$words*3+1]) - ord('0'));
+ $bs->appendNum(7, $val);
+ }
+
+ $this->bstream = $bs;
+ return 0;
+
+ } catch (Exception $e) {
+ return -1;
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public function encodeModeAn($version)
+ {
+ try {
+ $words = (int)($this->size / 2);
+ $bs = new QRbitstream();
+
+ $bs->appendNum(4, 0x02);
+ $bs->appendNum(QRspec::lengthIndicator(QR_MODE_AN, $version), $this->size);
+
+ for($i=0; $i<$words; $i++) {
+ $val = (int)QRinput::lookAnTable(ord($this->data[$i*2 ])) * 45;
+ $val += (int)QRinput::lookAnTable(ord($this->data[$i*2+1]));
+
+ $bs->appendNum(11, $val);
+ }
+
+ if($this->size & 1) {
+ $val = QRinput::lookAnTable(ord($this->data[$words * 2]));
+ $bs->appendNum(6, $val);
+ }
+
+ $this->bstream = $bs;
+ return 0;
+
+ } catch (Exception $e) {
+ return -1;
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public function encodeMode8($version)
+ {
+ try {
+ $bs = new QRbitstream();
+
+ $bs->appendNum(4, 0x4);
+ $bs->appendNum(QRspec::lengthIndicator(QR_MODE_8, $version), $this->size);
+
+ for($i=0; $i<$this->size; $i++) {
+ $bs->appendNum(8, ord($this->data[$i]));
+ }
+
+ $this->bstream = $bs;
+ return 0;
+
+ } catch (Exception $e) {
+ return -1;
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public function encodeModeKanji($version)
+ {
+ try {
+
+ $bs = new QRbitrtream();
+
+ $bs->appendNum(4, 0x8);
+ $bs->appendNum(QRspec::lengthIndicator(QR_MODE_KANJI, $version), (int)($this->size / 2));
+
+ for($i=0; $i<$this->size; $i+=2) {
+ $val = (ord($this->data[$i]) << 8) | ord($this->data[$i+1]);
+ if($val <= 0x9ffc) {
+ $val -= 0x8140;
+ } else {
+ $val -= 0xc140;
+ }
+
+ $h = ($val >> 8) * 0xc0;
+ $val = ($val & 0xff) + $h;
+
+ $bs->appendNum(13, $val);
+ }
+
+ $this->bstream = $bs;
+ return 0;
+
+ } catch (Exception $e) {
+ return -1;
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public function encodeModeStructure()
+ {
+ try {
+ $bs = new QRbitstream();
+
+ $bs->appendNum(4, 0x03);
+ $bs->appendNum(4, ord($this->data[1]) - 1);
+ $bs->appendNum(4, ord($this->data[0]) - 1);
+ $bs->appendNum(8, ord($this->data[2]));
+
+ $this->bstream = $bs;
+ return 0;
+
+ } catch (Exception $e) {
+ return -1;
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public function estimateBitStreamSizeOfEntry($version)
+ {
+ $bits = 0;
+
+ if($version == 0)
+ $version = 1;
+
+ switch($this->mode) {
+ case QR_MODE_NUM: $bits = QRinput::estimateBitsModeNum($this->size); break;
+ case QR_MODE_AN: $bits = QRinput::estimateBitsModeAn($this->size); break;
+ case QR_MODE_8: $bits = QRinput::estimateBitsMode8($this->size); break;
+ case QR_MODE_KANJI: $bits = QRinput::estimateBitsModeKanji($this->size);break;
+ case QR_MODE_STRUCTURE: return STRUCTURE_HEADER_BITS;
+ default:
+ return 0;
+ }
+
+ $l = QRspec::lengthIndicator($this->mode, $version);
+ $m = 1 << $l;
+ $num = (int)(($this->size + $m - 1) / $m);
+
+ $bits += $num * (4 + $l);
+
+ return $bits;
+ }
+
+ //----------------------------------------------------------------------
+ public function encodeBitStream($version)
+ {
+ try {
+
+ unset($this->bstream);
+ $words = QRspec::maximumWords($this->mode, $version);
+
+ if($this->size > $words) {
+
+ $st1 = new QRinputItem($this->mode, $words, $this->data);
+ $st2 = new QRinputItem($this->mode, $this->size - $words, array_slice($this->data, $words));
+
+ $st1->encodeBitStream($version);
+ $st2->encodeBitStream($version);
+
+ $this->bstream = new QRbitstream();
+ $this->bstream->append($st1->bstream);
+ $this->bstream->append($st2->bstream);
+
+ unset($st1);
+ unset($st2);
+
+ } else {
+
+ $ret = 0;
+
+ switch($this->mode) {
+ case QR_MODE_NUM: $ret = $this->encodeModeNum($version); break;
+ case QR_MODE_AN: $ret = $this->encodeModeAn($version); break;
+ case QR_MODE_8: $ret = $this->encodeMode8($version); break;
+ case QR_MODE_KANJI: $ret = $this->encodeModeKanji($version);break;
+ case QR_MODE_STRUCTURE: $ret = $this->encodeModeStructure(); break;
+
+ default:
+ break;
+ }
+
+ if($ret < 0)
+ return -1;
+ }
+
+ return $this->bstream->size();
+
+ } catch (Exception $e) {
+ return -1;
+ }
+ }
+ };
+
+ //##########################################################################
+
+ class QRinput {
+
+ public $items;
+
+ private $version;
+ private $level;
+
+ //----------------------------------------------------------------------
+ public function __construct($version = 0, $level = QR_ECLEVEL_L)
+ {
+ if ($version < 0 || $version > QRSPEC_VERSION_MAX || $level > QR_ECLEVEL_H) {
+ throw new Exception('Invalid version no');
+ return NULL;
+ }
+
+ $this->version = $version;
+ $this->level = $level;
+ }
+
+ //----------------------------------------------------------------------
+ public function getVersion()
+ {
+ return $this->version;
+ }
+
+ //----------------------------------------------------------------------
+ public function setVersion($version)
+ {
+ if($version < 0 || $version > QRSPEC_VERSION_MAX) {
+ throw new Exception('Invalid version no');
+ return -1;
+ }
+
+ $this->version = $version;
+
+ return 0;
+ }
+
+ //----------------------------------------------------------------------
+ public function getErrorCorrectionLevel()
+ {
+ return $this->level;
+ }
+
+ //----------------------------------------------------------------------
+ public function setErrorCorrectionLevel($level)
+ {
+ if($level > QR_ECLEVEL_H) {
+ throw new Exception('Invalid ECLEVEL');
+ return -1;
+ }
+
+ $this->level = $level;
+
+ return 0;
+ }
+
+ //----------------------------------------------------------------------
+ public function appendEntry(QRinputItem $entry)
+ {
+ $this->items[] = $entry;
+ }
+
+ //----------------------------------------------------------------------
+ public function append($mode, $size, $data)
+ {
+ try {
+ $entry = new QRinputItem($mode, $size, $data);
+ $this->items[] = $entry;
+ return 0;
+ } catch (Exception $e) {
+ return -1;
+ }
+ }
+
+ //----------------------------------------------------------------------
+
+ public function insertStructuredAppendHeader($size, $index, $parity)
+ {
+ if( $size > MAX_STRUCTURED_SYMBOLS ) {
+ throw new Exception('insertStructuredAppendHeader wrong size');
+ }
+
+ if( $index <= 0 || $index > MAX_STRUCTURED_SYMBOLS ) {
+ throw new Exception('insertStructuredAppendHeader wrong index');
+ }
+
+ $buf = array($size, $index, $parity);
+
+ try {
+ $entry = new QRinputItem(QR_MODE_STRUCTURE, 3, buf);
+ array_unshift($this->items, $entry);
+ return 0;
+ } catch (Exception $e) {
+ return -1;
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public function calcParity()
+ {
+ $parity = 0;
+
+ foreach($this->items as $item) {
+ if($item->mode != QR_MODE_STRUCTURE) {
+ for($i=$item->size-1; $i>=0; $i--) {
+ $parity ^= $item->data[$i];
+ }
+ }
+ }
+
+ return $parity;
+ }
+
+ //----------------------------------------------------------------------
+ public static function checkModeNum($size, $data)
+ {
+ for($i=0; $i<$size; $i++) {
+ if((ord($data[$i]) < ord('0')) || (ord($data[$i]) > ord('9'))){
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ //----------------------------------------------------------------------
+ public static function estimateBitsModeNum($size)
+ {
+ $w = (int)$size / 3;
+ $bits = $w * 10;
+
+ switch($size - $w * 3) {
+ case 1:
+ $bits += 4;
+ break;
+ case 2:
+ $bits += 7;
+ break;
+ default:
+ break;
+ }
+
+ return $bits;
+ }
+
+ //----------------------------------------------------------------------
+ public static $anTable = array(
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1,
+ -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+ );
+
+ //----------------------------------------------------------------------
+ public static function lookAnTable($c)
+ {
+ return (($c > 127)?-1:self::$anTable[$c]);
+ }
+
+ //----------------------------------------------------------------------
+ public static function checkModeAn($size, $data)
+ {
+ for($i=0; $i<$size; $i++) {
+ if (self::lookAnTable(ord($data[$i])) == -1) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ //----------------------------------------------------------------------
+ public static function estimateBitsModeAn($size)
+ {
+ $w = (int)($size / 2);
+ $bits = $w * 11;
+
+ if($size & 1) {
+ $bits += 6;
+ }
+
+ return $bits;
+ }
+
+ //----------------------------------------------------------------------
+ public static function estimateBitsMode8($size)
+ {
+ return $size * 8;
+ }
+
+ //----------------------------------------------------------------------
+ public function estimateBitsModeKanji($size)
+ {
+ return (int)(($size / 2) * 13);
+ }
+
+ //----------------------------------------------------------------------
+ public static function checkModeKanji($size, $data)
+ {
+ if($size & 1)
+ return false;
+
+ for($i=0; $i<$size; $i+=2) {
+ $val = (ord($data[$i]) << 8) | ord($data[$i+1]);
+ if( $val < 0x8140
+ || ($val > 0x9ffc && $val < 0xe040)
+ || $val > 0xebbf) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /***********************************************************************
+ * Validation
+ **********************************************************************/
+
+ public static function check($mode, $size, $data)
+ {
+ if($size <= 0)
+ return false;
+
+ switch($mode) {
+ case QR_MODE_NUM: return self::checkModeNum($size, $data); break;
+ case QR_MODE_AN: return self::checkModeAn($size, $data); break;
+ case QR_MODE_KANJI: return self::checkModeKanji($size, $data); break;
+ case QR_MODE_8: return true; break;
+ case QR_MODE_STRUCTURE: return true; break;
+
+ default:
+ break;
+ }
+
+ return false;
+ }
+
+
+ //----------------------------------------------------------------------
+ public function estimateBitStreamSize($version)
+ {
+ $bits = 0;
+
+ foreach($this->items as $item) {
+ $bits += $item->estimateBitStreamSizeOfEntry($version);
+ }
+
+ return $bits;
+ }
+
+ //----------------------------------------------------------------------
+ public function estimateVersion()
+ {
+ $version = 0;
+ $prev = 0;
+ do {
+ $prev = $version;
+ $bits = $this->estimateBitStreamSize($prev);
+ $version = QRspec::getMinimumVersion((int)(($bits + 7) / 8), $this->level);
+ if ($version < 0) {
+ return -1;
+ }
+ } while ($version > $prev);
+
+ return $version;
+ }
+
+ //----------------------------------------------------------------------
+ public static function lengthOfCode($mode, $version, $bits)
+ {
+ $payload = $bits - 4 - QRspec::lengthIndicator($mode, $version);
+ switch($mode) {
+ case QR_MODE_NUM:
+ $chunks = (int)($payload / 10);
+ $remain = $payload - $chunks * 10;
+ $size = $chunks * 3;
+ if($remain >= 7) {
+ $size += 2;
+ } else if($remain >= 4) {
+ $size += 1;
+ }
+ break;
+ case QR_MODE_AN:
+ $chunks = (int)($payload / 11);
+ $remain = $payload - $chunks * 11;
+ $size = $chunks * 2;
+ if($remain >= 6)
+ $size++;
+ break;
+ case QR_MODE_8:
+ $size = (int)($payload / 8);
+ break;
+ case QR_MODE_KANJI:
+ $size = (int)(($payload / 13) * 2);
+ break;
+ case QR_MODE_STRUCTURE:
+ $size = (int)($payload / 8);
+ break;
+ default:
+ $size = 0;
+ break;
+ }
+
+ $maxsize = QRspec::maximumWords($mode, $version);
+ if($size < 0) $size = 0;
+ if($size > $maxsize) $size = $maxsize;
+
+ return $size;
+ }
+
+ //----------------------------------------------------------------------
+ public function createBitStream()
+ {
+ $total = 0;
+
+ foreach($this->items as $item) {
+ $bits = $item->encodeBitStream($this->version);
+
+ if($bits < 0)
+ return -1;
+
+ $total += $bits;
+ }
+
+ return $total;
+ }
+
+ //----------------------------------------------------------------------
+ public function convertData()
+ {
+ $ver = $this->estimateVersion();
+ if($ver > $this->getVersion()) {
+ $this->setVersion($ver);
+ }
+
+ for(;;) {
+ $bits = $this->createBitStream();
+
+ if($bits < 0)
+ return -1;
+
+ $ver = QRspec::getMinimumVersion((int)(($bits + 7) / 8), $this->level);
+ if($ver < 0) {
+ throw new Exception('WRONG VERSION');
+ return -1;
+ } else if($ver > $this->getVersion()) {
+ $this->setVersion($ver);
+ } else {
+ break;
+ }
+ }
+
+ return 0;
+ }
+
+ //----------------------------------------------------------------------
+ public function appendPaddingBit(&$bstream)
+ {
+ $bits = $bstream->size();
+ $maxwords = QRspec::getDataLength($this->version, $this->level);
+ $maxbits = $maxwords * 8;
+
+ if ($maxbits == $bits) {
+ return 0;
+ }
+
+ if ($maxbits - $bits < 5) {
+ return $bstream->appendNum($maxbits - $bits, 0);
+ }
+
+ $bits += 4;
+ $words = (int)(($bits + 7) / 8);
+
+ $padding = new QRbitstream();
+ $ret = $padding->appendNum($words * 8 - $bits + 4, 0);
+
+ if($ret < 0)
+ return $ret;
+
+ $padlen = $maxwords - $words;
+
+ if($padlen > 0) {
+
+ $padbuf = array();
+ for($i=0; $i<$padlen; $i++) {
+ $padbuf[$i] = ($i&1)?0x11:0xec;
+ }
+
+ $ret = $padding->appendBytes($padlen, $padbuf);
+
+ if($ret < 0)
+ return $ret;
+
+ }
+
+ $ret = $bstream->append($padding);
+
+ return $ret;
+ }
+
+ //----------------------------------------------------------------------
+ public function mergeBitStream()
+ {
+ if($this->convertData() < 0) {
+ return null;
+ }
+
+ $bstream = new QRbitstream();
+
+ foreach($this->items as $item) {
+ $ret = $bstream->append($item->bstream);
+ if($ret < 0) {
+ return null;
+ }
+ }
+
+ return $bstream;
+ }
+
+ //----------------------------------------------------------------------
+ public function getBitStream()
+ {
+
+ $bstream = $this->mergeBitStream();
+
+ if($bstream == null) {
+ return null;
+ }
+
+ $ret = $this->appendPaddingBit($bstream);
+ if($ret < 0) {
+ return null;
+ }
+
+ return $bstream;
+ }
+
+ //----------------------------------------------------------------------
+ public function getByteStream()
+ {
+ $bstream = $this->getBitStream();
+ if($bstream == null) {
+ return null;
+ }
+
+ return $bstream->toByte();
+ }
+ }
+
+
+
+
+
+
+//---- qrbitstream.php -----------------------------
+
+
+
+
+/*
+ * PHP QR Code encoder
+ *
+ * Bitstream class
+ *
+ * Based on libqrencode C library distributed under LGPL 2.1
+ * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+ class QRbitstream {
+
+ public $data = array();
+
+ //----------------------------------------------------------------------
+ public function size()
+ {
+ return count($this->data);
+ }
+
+ //----------------------------------------------------------------------
+ public function allocate($setLength)
+ {
+ $this->data = array_fill(0, $setLength, 0);
+ return 0;
+ }
+
+ //----------------------------------------------------------------------
+ public static function newFromNum($bits, $num)
+ {
+ $bstream = new QRbitstream();
+ $bstream->allocate($bits);
+
+ $mask = 1 << ($bits - 1);
+ for($i=0; $i<$bits; $i++) {
+ if($num & $mask) {
+ $bstream->data[$i] = 1;
+ } else {
+ $bstream->data[$i] = 0;
+ }
+ $mask = $mask >> 1;
+ }
+
+ return $bstream;
+ }
+
+ //----------------------------------------------------------------------
+ public static function newFromBytes($size, $data)
+ {
+ $bstream = new QRbitstream();
+ $bstream->allocate($size * 8);
+ $p=0;
+
+ for($i=0; $i<$size; $i++) {
+ $mask = 0x80;
+ for($j=0; $j<8; $j++) {
+ if($data[$i] & $mask) {
+ $bstream->data[$p] = 1;
+ } else {
+ $bstream->data[$p] = 0;
+ }
+ $p++;
+ $mask = $mask >> 1;
+ }
+ }
+
+ return $bstream;
+ }
+
+ //----------------------------------------------------------------------
+ public function append(QRbitstream $arg)
+ {
+ if (is_null($arg)) {
+ return -1;
+ }
+
+ if($arg->size() == 0) {
+ return 0;
+ }
+
+ if($this->size() == 0) {
+ $this->data = $arg->data;
+ return 0;
+ }
+
+ $this->data = array_values(array_merge($this->data, $arg->data));
+
+ return 0;
+ }
+
+ //----------------------------------------------------------------------
+ public function appendNum($bits, $num)
+ {
+ if ($bits == 0)
+ return 0;
+
+ $b = QRbitstream::newFromNum($bits, $num);
+
+ if(is_null($b))
+ return -1;
+
+ $ret = $this->append($b);
+ unset($b);
+
+ return $ret;
+ }
+
+ //----------------------------------------------------------------------
+ public function appendBytes($size, $data)
+ {
+ if ($size == 0)
+ return 0;
+
+ $b = QRbitstream::newFromBytes($size, $data);
+
+ if(is_null($b))
+ return -1;
+
+ $ret = $this->append($b);
+ unset($b);
+
+ return $ret;
+ }
+
+ //----------------------------------------------------------------------
+ public function toByte()
+ {
+
+ $size = $this->size();
+
+ if($size == 0) {
+ return array();
+ }
+
+ $data = array_fill(0, (int)(($size + 7) / 8), 0);
+ $bytes = (int)($size / 8);
+
+ $p = 0;
+
+ for($i=0; $i<$bytes; $i++) {
+ $v = 0;
+ for($j=0; $j<8; $j++) {
+ $v = $v << 1;
+ $v |= $this->data[$p];
+ $p++;
+ }
+ $data[$i] = $v;
+ }
+
+ if($size & 7) {
+ $v = 0;
+ for($j=0; $j<($size & 7); $j++) {
+ $v = $v << 1;
+ $v |= $this->data[$p];
+ $p++;
+ }
+ $data[$bytes] = $v;
+ }
+
+ return $data;
+ }
+
+ }
+
+
+
+
+//---- qrsplit.php -----------------------------
+
+
+
+
+/*
+ * PHP QR Code encoder
+ *
+ * InputGenerator splitting classes
+ *
+ * Based on libqrencode C library distributed under LGPL 2.1
+ * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia
+ *
+ * The following data / specifications are taken from
+ * "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004)
+ * or
+ * "Automatic identification and data capture techniques --
+ * QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+ class QRsplit {
+
+ public $dataStr = '';
+ public $input;
+ public $modeHint;
+
+ //----------------------------------------------------------------------
+ public function __construct($dataStr, $input, $modeHint)
+ {
+ $this->dataStr = $dataStr;
+ $this->input = $input;
+ $this->modeHint = $modeHint;
+ }
+
+ //----------------------------------------------------------------------
+ public static function isdigitat($str, $pos)
+ {
+ if ($pos >= strlen($str))
+ return false;
+
+ return ((ord($str[$pos]) >= ord('0'))&&(ord($str[$pos]) <= ord('9')));
+ }
+
+ //----------------------------------------------------------------------
+ public static function isalnumat($str, $pos)
+ {
+ if ($pos >= strlen($str))
+ return false;
+
+ return (QRinput::lookAnTable(ord($str[$pos])) >= 0);
+ }
+
+ //----------------------------------------------------------------------
+ public function identifyMode($pos)
+ {
+ if ($pos >= strlen($this->dataStr))
+ return QR_MODE_NUL;
+
+ $c = $this->dataStr[$pos];
+
+ if(self::isdigitat($this->dataStr, $pos)) {
+ return QR_MODE_NUM;
+ } else if(self::isalnumat($this->dataStr, $pos)) {
+ return QR_MODE_AN;
+ } else if($this->modeHint == QR_MODE_KANJI) {
+
+ if ($pos+1 < strlen($this->dataStr))
+ {
+ $d = $this->dataStr[$pos+1];
+ $word = (ord($c) << 8) | ord($d);
+ if(($word >= 0x8140 && $word <= 0x9ffc) || ($word >= 0xe040 && $word <= 0xebbf)) {
+ return QR_MODE_KANJI;
+ }
+ }
+ }
+
+ return QR_MODE_8;
+ }
+
+ //----------------------------------------------------------------------
+ public function eatNum()
+ {
+ $ln = QRspec::lengthIndicator(QR_MODE_NUM, $this->input->getVersion());
+
+ $p = 0;
+ while(self::isdigitat($this->dataStr, $p)) {
+ $p++;
+ }
+
+ $run = $p;
+ $mode = $this->identifyMode($p);
+
+ if($mode == QR_MODE_8) {
+ $dif = QRinput::estimateBitsModeNum($run) + 4 + $ln
+ + QRinput::estimateBitsMode8(1) // + 4 + l8
+ - QRinput::estimateBitsMode8($run + 1); // - 4 - l8
+ if($dif > 0) {
+ return $this->eat8();
+ }
+ }
+ if($mode == QR_MODE_AN) {
+ $dif = QRinput::estimateBitsModeNum($run) + 4 + $ln
+ + QRinput::estimateBitsModeAn(1) // + 4 + la
+ - QRinput::estimateBitsModeAn($run + 1);// - 4 - la
+ if($dif > 0) {
+ return $this->eatAn();
+ }
+ }
+
+ $ret = $this->input->append(QR_MODE_NUM, $run, str_split($this->dataStr));
+ if($ret < 0)
+ return -1;
+
+ return $run;
+ }
+
+ //----------------------------------------------------------------------
+ public function eatAn()
+ {
+ $la = QRspec::lengthIndicator(QR_MODE_AN, $this->input->getVersion());
+ $ln = QRspec::lengthIndicator(QR_MODE_NUM, $this->input->getVersion());
+
+ $p = 0;
+
+ while(self::isalnumat($this->dataStr, $p)) {
+ if(self::isdigitat($this->dataStr, $p)) {
+ $q = $p;
+ while(self::isdigitat($this->dataStr, $q)) {
+ $q++;
+ }
+
+ $dif = QRinput::estimateBitsModeAn($p) // + 4 + la
+ + QRinput::estimateBitsModeNum($q - $p) + 4 + $ln
+ - QRinput::estimateBitsModeAn($q); // - 4 - la
+
+ if($dif < 0) {
+ break;
+ } else {
+ $p = $q;
+ }
+ } else {
+ $p++;
+ }
+ }
+
+ $run = $p;
+
+ if(!self::isalnumat($this->dataStr, $p)) {
+ $dif = QRinput::estimateBitsModeAn($run) + 4 + $la
+ + QRinput::estimateBitsMode8(1) // + 4 + l8
+ - QRinput::estimateBitsMode8($run + 1); // - 4 - l8
+ if($dif > 0) {
+ return $this->eat8();
+ }
+ }
+
+ $ret = $this->input->append(QR_MODE_AN, $run, str_split($this->dataStr));
+ if($ret < 0)
+ return -1;
+
+ return $run;
+ }
+
+ //----------------------------------------------------------------------
+ public function eatKanji()
+ {
+ $p = 0;
+
+ while($this->identifyMode($p) == QR_MODE_KANJI) {
+ $p += 2;
+ }
+
+ $ret = $this->input->append(QR_MODE_KANJI, $p, str_split($this->dataStr));
+ if($ret < 0)
+ return -1;
+
+ return $run;
+ }
+
+ //----------------------------------------------------------------------
+ public function eat8()
+ {
+ $la = QRspec::lengthIndicator(QR_MODE_AN, $this->input->getVersion());
+ $ln = QRspec::lengthIndicator(QR_MODE_NUM, $this->input->getVersion());
+
+ $p = 1;
+ $dataStrLen = strlen($this->dataStr);
+
+ while($p < $dataStrLen) {
+
+ $mode = $this->identifyMode($p);
+ if($mode == QR_MODE_KANJI) {
+ break;
+ }
+ if($mode == QR_MODE_NUM) {
+ $q = $p;
+ while(self::isdigitat($this->dataStr, $q)) {
+ $q++;
+ }
+ $dif = QRinput::estimateBitsMode8($p) // + 4 + l8
+ + QRinput::estimateBitsModeNum($q - $p) + 4 + $ln
+ - QRinput::estimateBitsMode8($q); // - 4 - l8
+ if($dif < 0) {
+ break;
+ } else {
+ $p = $q;
+ }
+ } else if($mode == QR_MODE_AN) {
+ $q = $p;
+ while(self::isalnumat($this->dataStr, $q)) {
+ $q++;
+ }
+ $dif = QRinput::estimateBitsMode8($p) // + 4 + l8
+ + QRinput::estimateBitsModeAn($q - $p) + 4 + $la
+ - QRinput::estimateBitsMode8($q); // - 4 - l8
+ if($dif < 0) {
+ break;
+ } else {
+ $p = $q;
+ }
+ } else {
+ $p++;
+ }
+ }
+
+ $run = $p;
+ $ret = $this->input->append(QR_MODE_8, $run, str_split($this->dataStr));
+
+ if($ret < 0)
+ return -1;
+
+ return $run;
+ }
+
+ //----------------------------------------------------------------------
+ public function splitString()
+ {
+ while (strlen($this->dataStr) > 0)
+ {
+ if($this->dataStr == '')
+ return 0;
+
+ $mode = $this->identifyMode(0);
+
+ switch ($mode) {
+ case QR_MODE_NUM: $length = $this->eatNum(); break;
+ case QR_MODE_AN: $length = $this->eatAn(); break;
+ case QR_MODE_KANJI:
+ if ($hint == QR_MODE_KANJI)
+ $length = $this->eatKanji();
+ else $length = $this->eat8();
+ break;
+ default: $length = $this->eat8(); break;
+
+ }
+
+ if($length == 0) return 0;
+ if($length < 0) return -1;
+
+ $this->dataStr = substr($this->dataStr, $length);
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public function toUpper()
+ {
+ $stringLen = strlen($this->dataStr);
+ $p = 0;
+
+ while ($p<$stringLen) {
+ $mode = self::identifyMode(substr($this->dataStr, $p), $this->modeHint);
+ if($mode == QR_MODE_KANJI) {
+ $p += 2;
+ } else {
+ if (ord($this->dataStr[$p]) >= ord('a') && ord($this->dataStr[$p]) <= ord('z')) {
+ $this->dataStr[$p] = chr(ord($this->dataStr[$p]) - 32);
+ }
+ $p++;
+ }
+ }
+
+ return $this->dataStr;
+ }
+
+ //----------------------------------------------------------------------
+ public static function splitStringToQRinput($string, QRinput $input, $modeHint, $casesensitive = true)
+ {
+ if(is_null($string) || $string == '\0' || $string == '') {
+ throw new Exception('empty string!!!');
+ }
+
+ $split = new QRsplit($string, $input, $modeHint);
+
+ if(!$casesensitive)
+ $split->toUpper();
+
+ return $split->splitString();
+ }
+ }
+
+
+
+//---- qrrscode.php -----------------------------
+
+
+
+
+/*
+ * PHP QR Code encoder
+ *
+ * Reed-Solomon error correction support
+ *
+ * Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q
+ * (libfec is released under the GNU Lesser General Public License.)
+ *
+ * Based on libqrencode C library distributed under LGPL 2.1
+ * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+ class QRrsItem {
+
+ public $mm; // Bits per symbol
+ public $nn; // Symbols per block (= (1<= $this->nn) {
+ $x -= $this->nn;
+ $x = ($x >> $this->mm) + ($x & $this->nn);
+ }
+
+ return $x;
+ }
+
+ //----------------------------------------------------------------------
+ public static function init_rs_char($symsize, $gfpoly, $fcr, $prim, $nroots, $pad)
+ {
+ // Common code for intializing a Reed-Solomon control block (char or int symbols)
+ // Copyright 2004 Phil Karn, KA9Q
+ // May be used under the terms of the GNU Lesser General Public License (LGPL)
+
+ $rs = null;
+
+ // Check parameter ranges
+ if($symsize < 0 || $symsize > 8) return $rs;
+ if($fcr < 0 || $fcr >= (1<<$symsize)) return $rs;
+ if($prim <= 0 || $prim >= (1<<$symsize)) return $rs;
+ if($nroots < 0 || $nroots >= (1<<$symsize)) return $rs; // Can't have more roots than symbol values!
+ if($pad < 0 || $pad >= ((1<<$symsize) -1 - $nroots)) return $rs; // Too much padding
+
+ $rs = new QRrsItem();
+ $rs->mm = $symsize;
+ $rs->nn = (1<<$symsize)-1;
+ $rs->pad = $pad;
+
+ $rs->alpha_to = array_fill(0, $rs->nn+1, 0);
+ $rs->index_of = array_fill(0, $rs->nn+1, 0);
+
+ // PHP style macro replacement ;)
+ $NN =& $rs->nn;
+ $A0 =& $NN;
+
+ // Generate Galois field lookup tables
+ $rs->index_of[0] = $A0; // log(zero) = -inf
+ $rs->alpha_to[$A0] = 0; // alpha**-inf = 0
+ $sr = 1;
+
+ for($i=0; $i<$rs->nn; $i++) {
+ $rs->index_of[$sr] = $i;
+ $rs->alpha_to[$i] = $sr;
+ $sr <<= 1;
+ if($sr & (1<<$symsize)) {
+ $sr ^= $gfpoly;
+ }
+ $sr &= $rs->nn;
+ }
+
+ if($sr != 1){
+ // field generator polynomial is not primitive!
+ $rs = NULL;
+ return $rs;
+ }
+
+ /* Form RS code generator polynomial from its roots */
+ $rs->genpoly = array_fill(0, $nroots+1, 0);
+
+ $rs->fcr = $fcr;
+ $rs->prim = $prim;
+ $rs->nroots = $nroots;
+ $rs->gfpoly = $gfpoly;
+
+ /* Find prim-th root of 1, used in decoding */
+ for($iprim=1;($iprim % $prim) != 0;$iprim += $rs->nn)
+ ; // intentional empty-body loop!
+
+ $rs->iprim = (int)($iprim / $prim);
+ $rs->genpoly[0] = 1;
+
+ for ($i = 0,$root=$fcr*$prim; $i < $nroots; $i++, $root += $prim) {
+ $rs->genpoly[$i+1] = 1;
+
+ // Multiply rs->genpoly[] by @**(root + x)
+ for ($j = $i; $j > 0; $j--) {
+ if ($rs->genpoly[$j] != 0) {
+ $rs->genpoly[$j] = $rs->genpoly[$j-1] ^ $rs->alpha_to[$rs->modnn($rs->index_of[$rs->genpoly[$j]] + $root)];
+ } else {
+ $rs->genpoly[$j] = $rs->genpoly[$j-1];
+ }
+ }
+ // rs->genpoly[0] can never be zero
+ $rs->genpoly[0] = $rs->alpha_to[$rs->modnn($rs->index_of[$rs->genpoly[0]] + $root)];
+ }
+
+ // convert rs->genpoly[] to index form for quicker encoding
+ for ($i = 0; $i <= $nroots; $i++)
+ $rs->genpoly[$i] = $rs->index_of[$rs->genpoly[$i]];
+
+ return $rs;
+ }
+
+ //----------------------------------------------------------------------
+ public function encode_rs_char($data, &$parity)
+ {
+ $MM =& $this->mm;
+ $NN =& $this->nn;
+ $ALPHA_TO =& $this->alpha_to;
+ $INDEX_OF =& $this->index_of;
+ $GENPOLY =& $this->genpoly;
+ $NROOTS =& $this->nroots;
+ $FCR =& $this->fcr;
+ $PRIM =& $this->prim;
+ $IPRIM =& $this->iprim;
+ $PAD =& $this->pad;
+ $A0 =& $NN;
+
+ $parity = array_fill(0, $NROOTS, 0);
+
+ for($i=0; $i< ($NN-$NROOTS-$PAD); $i++) {
+
+ $feedback = $INDEX_OF[$data[$i] ^ $parity[0]];
+ if($feedback != $A0) {
+ // feedback term is non-zero
+
+ // This line is unnecessary when GENPOLY[NROOTS] is unity, as it must
+ // always be for the polynomials constructed by init_rs()
+ $feedback = $this->modnn($NN - $GENPOLY[$NROOTS] + $feedback);
+
+ for($j=1;$j<$NROOTS;$j++) {
+ $parity[$j] ^= $ALPHA_TO[$this->modnn($feedback + $GENPOLY[$NROOTS-$j])];
+ }
+ }
+
+ // Shift
+ array_shift($parity);
+ if($feedback != $A0) {
+ array_push($parity, $ALPHA_TO[$this->modnn($feedback + $GENPOLY[0])]);
+ } else {
+ array_push($parity, 0);
+ }
+ }
+ }
+ }
+
+ //##########################################################################
+
+ class QRrs {
+
+ public static $items = array();
+
+ //----------------------------------------------------------------------
+ public static function init_rs($symsize, $gfpoly, $fcr, $prim, $nroots, $pad)
+ {
+ foreach(self::$items as $rs) {
+ if($rs->pad != $pad) continue;
+ if($rs->nroots != $nroots) continue;
+ if($rs->mm != $symsize) continue;
+ if($rs->gfpoly != $gfpoly) continue;
+ if($rs->fcr != $fcr) continue;
+ if($rs->prim != $prim) continue;
+
+ return $rs;
+ }
+
+ $rs = QRrsItem::init_rs_char($symsize, $gfpoly, $fcr, $prim, $nroots, $pad);
+ array_unshift(self::$items, $rs);
+
+ return $rs;
+ }
+ }
+
+
+
+//---- qrmask.php -----------------------------
+
+
+
+
+/*
+ * PHP QR Code encoder
+ *
+ * Masking
+ *
+ * Based on libqrencode C library distributed under LGPL 2.1
+ * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+ define('N1', 3);
+ define('N2', 3);
+ define('N3', 40);
+ define('N4', 10);
+
+ class QRmask {
+
+ public $runLength = array();
+
+ //----------------------------------------------------------------------
+ public function __construct()
+ {
+ $this->runLength = array_fill(0, QRSPEC_WIDTH_MAX + 1, 0);
+ }
+
+ //----------------------------------------------------------------------
+ public function writeFormatInformation($width, &$frame, $mask, $level)
+ {
+ $blacks = 0;
+ $format = QRspec::getFormatInfo($mask, $level);
+
+ for($i=0; $i<8; $i++) {
+ if($format & 1) {
+ $blacks += 2;
+ $v = 0x85;
+ } else {
+ $v = 0x84;
+ }
+
+ $frame[8][$width - 1 - $i] = chr($v);
+ if($i < 6) {
+ $frame[$i][8] = chr($v);
+ } else {
+ $frame[$i + 1][8] = chr($v);
+ }
+ $format = $format >> 1;
+ }
+
+ for($i=0; $i<7; $i++) {
+ if($format & 1) {
+ $blacks += 2;
+ $v = 0x85;
+ } else {
+ $v = 0x84;
+ }
+
+ $frame[$width - 7 + $i][8] = chr($v);
+ if($i == 0) {
+ $frame[8][7] = chr($v);
+ } else {
+ $frame[8][6 - $i] = chr($v);
+ }
+
+ $format = $format >> 1;
+ }
+
+ return $blacks;
+ }
+
+ //----------------------------------------------------------------------
+ public function mask0($x, $y) { return ($x+$y)&1; }
+ public function mask1($x, $y) { return ($y&1); }
+ public function mask2($x, $y) { return ($x%3); }
+ public function mask3($x, $y) { return ($x+$y)%3; }
+ public function mask4($x, $y) { return (((int)($y/2))+((int)($x/3)))&1; }
+ public function mask5($x, $y) { return (($x*$y)&1)+($x*$y)%3; }
+ public function mask6($x, $y) { return ((($x*$y)&1)+($x*$y)%3)&1; }
+ public function mask7($x, $y) { return ((($x*$y)%3)+(($x+$y)&1))&1; }
+
+ //----------------------------------------------------------------------
+ private function generateMaskNo($maskNo, $width, $frame)
+ {
+ $bitMask = array_fill(0, $width, array_fill(0, $width, 0));
+
+ for($y=0; $y<$width; $y++) {
+ for($x=0; $x<$width; $x++) {
+ if(ord($frame[$y][$x]) & 0x80) {
+ $bitMask[$y][$x] = 0;
+ } else {
+ $maskFunc = call_user_func(array($this, 'mask'.$maskNo), $x, $y);
+ $bitMask[$y][$x] = ($maskFunc == 0)?1:0;
+ }
+
+ }
+ }
+
+ return $bitMask;
+ }
+
+ //----------------------------------------------------------------------
+ public static function serial($bitFrame)
+ {
+ $codeArr = array();
+
+ foreach ($bitFrame as $line)
+ $codeArr[] = join('', $line);
+
+ return gzcompress(join("\n", $codeArr), 9);
+ }
+
+ //----------------------------------------------------------------------
+ public static function unserial($code)
+ {
+ $codeArr = array();
+
+ $codeLines = explode("\n", gzuncompress($code));
+ foreach ($codeLines as $line)
+ $codeArr[] = str_split($line);
+
+ return $codeArr;
+ }
+
+ //----------------------------------------------------------------------
+ public function makeMaskNo($maskNo, $width, $s, &$d, $maskGenOnly = false)
+ {
+ $b = 0;
+ $bitMask = array();
+
+ $fileName = QR_CACHE_DIR.'mask_'.$maskNo.DIRECTORY_SEPARATOR.'mask_'.$width.'_'.$maskNo.'.dat';
+
+ if (QR_CACHEABLE) {
+ if (file_exists($fileName)) {
+ $bitMask = self::unserial(file_get_contents($fileName));
+ } else {
+ $bitMask = $this->generateMaskNo($maskNo, $width, $s, $d);
+ if (!file_exists(QR_CACHE_DIR.'mask_'.$maskNo))
+ mkdir(QR_CACHE_DIR.'mask_'.$maskNo);
+ file_put_contents($fileName, self::serial($bitMask));
+ }
+ } else {
+ $bitMask = $this->generateMaskNo($maskNo, $width, $s, $d);
+ }
+
+ if ($maskGenOnly)
+ return;
+
+ $d = $s;
+
+ for($y=0; $y<$width; $y++) {
+ for($x=0; $x<$width; $x++) {
+ if($bitMask[$y][$x] == 1) {
+ $d[$y][$x] = chr(ord($s[$y][$x]) ^ (int)$bitMask[$y][$x]);
+ }
+ $b += (int)(ord($d[$y][$x]) & 1);
+ }
+ }
+
+ return $b;
+ }
+
+ //----------------------------------------------------------------------
+ public function makeMask($width, $frame, $maskNo, $level)
+ {
+ $masked = array_fill(0, $width, str_repeat("\0", $width));
+ $this->makeMaskNo($maskNo, $width, $frame, $masked);
+ $this->writeFormatInformation($width, $masked, $maskNo, $level);
+
+ return $masked;
+ }
+
+ //----------------------------------------------------------------------
+ public function calcN1N3($length)
+ {
+ $demerit = 0;
+
+ for($i=0; $i<$length; $i++) {
+
+ if($this->runLength[$i] >= 5) {
+ $demerit += (N1 + ($this->runLength[$i] - 5));
+ }
+ if($i & 1) {
+ if(($i >= 3) && ($i < ($length-2)) && ($this->runLength[$i] % 3 == 0)) {
+ $fact = (int)($this->runLength[$i] / 3);
+ if(($this->runLength[$i-2] == $fact) &&
+ ($this->runLength[$i-1] == $fact) &&
+ ($this->runLength[$i+1] == $fact) &&
+ ($this->runLength[$i+2] == $fact)) {
+ if(($this->runLength[$i-3] < 0) || ($this->runLength[$i-3] >= (4 * $fact))) {
+ $demerit += N3;
+ } else if((($i+3) >= $length) || ($this->runLength[$i+3] >= (4 * $fact))) {
+ $demerit += N3;
+ }
+ }
+ }
+ }
+ }
+ return $demerit;
+ }
+
+ //----------------------------------------------------------------------
+ public function evaluateSymbol($width, $frame)
+ {
+ $head = 0;
+ $demerit = 0;
+
+ for($y=0; $y<$width; $y++) {
+ $head = 0;
+ $this->runLength[0] = 1;
+
+ $frameY = $frame[$y];
+
+ if ($y>0)
+ $frameYM = $frame[$y-1];
+
+ for($x=0; $x<$width; $x++) {
+ if(($x > 0) && ($y > 0)) {
+ $b22 = ord($frameY[$x]) & ord($frameY[$x-1]) & ord($frameYM[$x]) & ord($frameYM[$x-1]);
+ $w22 = ord($frameY[$x]) | ord($frameY[$x-1]) | ord($frameYM[$x]) | ord($frameYM[$x-1]);
+
+ if(($b22 | ($w22 ^ 1))&1) {
+ $demerit += N2;
+ }
+ }
+ if(($x == 0) && (ord($frameY[$x]) & 1)) {
+ $this->runLength[0] = -1;
+ $head = 1;
+ $this->runLength[$head] = 1;
+ } else if($x > 0) {
+ if((ord($frameY[$x]) ^ ord($frameY[$x-1])) & 1) {
+ $head++;
+ $this->runLength[$head] = 1;
+ } else {
+ $this->runLength[$head]++;
+ }
+ }
+ }
+
+ $demerit += $this->calcN1N3($head+1);
+ }
+
+ for($x=0; $x<$width; $x++) {
+ $head = 0;
+ $this->runLength[0] = 1;
+
+ for($y=0; $y<$width; $y++) {
+ if($y == 0 && (ord($frame[$y][$x]) & 1)) {
+ $this->runLength[0] = -1;
+ $head = 1;
+ $this->runLength[$head] = 1;
+ } else if($y > 0) {
+ if((ord($frame[$y][$x]) ^ ord($frame[$y-1][$x])) & 1) {
+ $head++;
+ $this->runLength[$head] = 1;
+ } else {
+ $this->runLength[$head]++;
+ }
+ }
+ }
+
+ $demerit += $this->calcN1N3($head+1);
+ }
+
+ return $demerit;
+ }
+
+
+ //----------------------------------------------------------------------
+ public function mask($width, $frame, $level)
+ {
+ $minDemerit = PHP_INT_MAX;
+ $bestMaskNum = 0;
+ $bestMask = array();
+
+ $checked_masks = array(0,1,2,3,4,5,6,7);
+
+ if (QR_FIND_FROM_RANDOM !== false) {
+
+ $howManuOut = 8-(QR_FIND_FROM_RANDOM % 9);
+ for ($i = 0; $i < $howManuOut; $i++) {
+ $remPos = rand (0, count($checked_masks)-1);
+ unset($checked_masks[$remPos]);
+ $checked_masks = array_values($checked_masks);
+ }
+
+ }
+
+ $bestMask = $frame;
+
+ foreach($checked_masks as $i) {
+ $mask = array_fill(0, $width, str_repeat("\0", $width));
+
+ $demerit = 0;
+ $blacks = 0;
+ $blacks = $this->makeMaskNo($i, $width, $frame, $mask);
+ $blacks += $this->writeFormatInformation($width, $mask, $i, $level);
+ $blacks = (int)(100 * $blacks / ($width * $width));
+ $demerit = (int)((int)(abs($blacks - 50) / 5) * N4);
+ $demerit += $this->evaluateSymbol($width, $mask);
+
+ if($demerit < $minDemerit) {
+ $minDemerit = $demerit;
+ $bestMask = $mask;
+ $bestMaskNum = $i;
+ }
+ }
+
+ return $bestMask;
+ }
+
+ //----------------------------------------------------------------------
+ }
+
+
+
+
+//---- qrencode.php -----------------------------
+
+
+
+
+/*
+ * PHP QR Code encoder
+ *
+ * Main encoder classes.
+ *
+ * Based on libqrencode C library distributed under LGPL 2.1
+ * Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+ class QRrsblock {
+ public $dataLength;
+ public $data = array();
+ public $eccLength;
+ public $ecc = array();
+
+ public function __construct($dl, $data, $el, &$ecc, QRrsItem $rs)
+ {
+ $rs->encode_rs_char($data, $ecc);
+
+ $this->dataLength = $dl;
+ $this->data = $data;
+ $this->eccLength = $el;
+ $this->ecc = $ecc;
+ }
+ };
+
+ //##########################################################################
+
+ class QRrawcode {
+ public $version;
+ public $datacode = array();
+ public $ecccode = array();
+ public $blocks;
+ public $rsblocks = array(); //of RSblock
+ public $count;
+ public $dataLength;
+ public $eccLength;
+ public $b1;
+
+ //----------------------------------------------------------------------
+ public function __construct(QRinput $input)
+ {
+ $spec = array(0,0,0,0,0);
+
+ $this->datacode = $input->getByteStream();
+ if(is_null($this->datacode)) {
+ throw new Exception('null imput string');
+ }
+
+ QRspec::getEccSpec($input->getVersion(), $input->getErrorCorrectionLevel(), $spec);
+
+ $this->version = $input->getVersion();
+ $this->b1 = QRspec::rsBlockNum1($spec);
+ $this->dataLength = QRspec::rsDataLength($spec);
+ $this->eccLength = QRspec::rsEccLength($spec);
+ $this->ecccode = array_fill(0, $this->eccLength, 0);
+ $this->blocks = QRspec::rsBlockNum($spec);
+
+ $ret = $this->init($spec);
+ if($ret < 0) {
+ throw new Exception('block alloc error');
+ return null;
+ }
+
+ $this->count = 0;
+ }
+
+ //----------------------------------------------------------------------
+ public function init(array $spec)
+ {
+ $dl = QRspec::rsDataCodes1($spec);
+ $el = QRspec::rsEccCodes1($spec);
+ $rs = QRrs::init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el);
+
+
+ $blockNo = 0;
+ $dataPos = 0;
+ $eccPos = 0;
+ for($i=0; $iecccode,$eccPos);
+ $this->rsblocks[$blockNo] = new QRrsblock($dl, array_slice($this->datacode, $dataPos), $el, $ecc, $rs);
+ $this->ecccode = array_merge(array_slice($this->ecccode,0, $eccPos), $ecc);
+
+ $dataPos += $dl;
+ $eccPos += $el;
+ $blockNo++;
+ }
+
+ if(QRspec::rsBlockNum2($spec) == 0)
+ return 0;
+
+ $dl = QRspec::rsDataCodes2($spec);
+ $el = QRspec::rsEccCodes2($spec);
+ $rs = QRrs::init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el);
+
+ if($rs == NULL) return -1;
+
+ for($i=0; $iecccode,$eccPos);
+ $this->rsblocks[$blockNo] = new QRrsblock($dl, array_slice($this->datacode, $dataPos), $el, $ecc, $rs);
+ $this->ecccode = array_merge(array_slice($this->ecccode,0, $eccPos), $ecc);
+
+ $dataPos += $dl;
+ $eccPos += $el;
+ $blockNo++;
+ }
+
+ return 0;
+ }
+
+ //----------------------------------------------------------------------
+ public function getCode()
+ {
+ $ret;
+
+ if($this->count < $this->dataLength) {
+ $row = $this->count % $this->blocks;
+ $col = $this->count / $this->blocks;
+ if($col >= $this->rsblocks[0]->dataLength) {
+ $row += $this->b1;
+ }
+ $ret = $this->rsblocks[$row]->data[$col];
+ } else if($this->count < $this->dataLength + $this->eccLength) {
+ $row = ($this->count - $this->dataLength) % $this->blocks;
+ $col = ($this->count - $this->dataLength) / $this->blocks;
+ $ret = $this->rsblocks[$row]->ecc[$col];
+ } else {
+ return 0;
+ }
+ $this->count++;
+
+ return $ret;
+ }
+ }
+
+ //##########################################################################
+
+ class QRcode {
+
+ public $version;
+ public $width;
+ public $data;
+
+ //----------------------------------------------------------------------
+ public function encodeMask(QRinput $input, $mask)
+ {
+ if($input->getVersion() < 0 || $input->getVersion() > QRSPEC_VERSION_MAX) {
+ throw new Exception('wrong version');
+ }
+ if($input->getErrorCorrectionLevel() > QR_ECLEVEL_H) {
+ throw new Exception('wrong level');
+ }
+
+ $raw = new QRrawcode($input);
+
+ QRtools::markTime('after_raw');
+
+ $version = $raw->version;
+ $width = QRspec::getWidth($version);
+ $frame = QRspec::newFrame($version);
+
+ $filler = new FrameFiller($width, $frame);
+ if(is_null($filler)) {
+ return NULL;
+ }
+
+ // inteleaved data and ecc codes
+ for($i=0; $i<$raw->dataLength + $raw->eccLength; $i++) {
+ $code = $raw->getCode();
+ $bit = 0x80;
+ for($j=0; $j<8; $j++) {
+ $addr = $filler->next();
+ $filler->setFrameAt($addr, 0x02 | (($bit & $code) != 0));
+ $bit = $bit >> 1;
+ }
+ }
+
+ QRtools::markTime('after_filler');
+
+ unset($raw);
+
+ // remainder bits
+ $j = QRspec::getRemainder($version);
+ for($i=0; $i<$j; $i++) {
+ $addr = $filler->next();
+ $filler->setFrameAt($addr, 0x02);
+ }
+
+ $frame = $filler->frame;
+ unset($filler);
+
+
+ // masking
+ $maskObj = new QRmask();
+ if($mask < 0) {
+
+ if (QR_FIND_BEST_MASK) {
+ $masked = $maskObj->mask($width, $frame, $input->getErrorCorrectionLevel());
+ } else {
+ $masked = $maskObj->makeMask($width, $frame, (intval(QR_DEFAULT_MASK) % 8), $input->getErrorCorrectionLevel());
+ }
+ } else {
+ $masked = $maskObj->makeMask($width, $frame, $mask, $input->getErrorCorrectionLevel());
+ }
+
+ if($masked == NULL) {
+ return NULL;
+ }
+
+ QRtools::markTime('after_mask');
+
+ $this->version = $version;
+ $this->width = $width;
+ $this->data = $masked;
+
+ return $this;
+ }
+
+ //----------------------------------------------------------------------
+ public function encodeInput(QRinput $input)
+ {
+ return $this->encodeMask($input, -1);
+ }
+
+ //----------------------------------------------------------------------
+ public function encodeString8bit($string, $version, $level)
+ {
+ if(string == NULL) {
+ throw new Exception('empty string!');
+ return NULL;
+ }
+
+ $input = new QRinput($version, $level);
+ if($input == NULL) return NULL;
+
+ $ret = $input->append($input, QR_MODE_8, strlen($string), str_split($string));
+ if($ret < 0) {
+ unset($input);
+ return NULL;
+ }
+ return $this->encodeInput($input);
+ }
+
+ //----------------------------------------------------------------------
+ public function encodeString($string, $version, $level, $hint, $casesensitive)
+ {
+
+ if($hint != QR_MODE_8 && $hint != QR_MODE_KANJI) {
+ throw new Exception('bad hint');
+ return NULL;
+ }
+
+ $input = new QRinput($version, $level);
+ if($input == NULL) return NULL;
+
+ $ret = QRsplit::splitStringToQRinput($string, $input, $hint, $casesensitive);
+ if($ret < 0) {
+ return NULL;
+ }
+
+ return $this->encodeInput($input);
+ }
+
+ //----------------------------------------------------------------------
+ public static function png($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4, $saveAndPrint = false)
+ {
+ $enc = QRencode::factory($level, $size, $margin);
+ return $enc->encodePNG($text, $outfile, $saveAndPrint);
+ }
+
+ //----------------------------------------------------------------------
+ public static function re_png($text, $level = QR_ECLEVEL_L, $size = 3, $margin = 4)
+ {
+ $enc = QRencode::factory($level, $size, $margin);
+ return $enc->re_encodePNG($text);
+ }
+
+ //----------------------------------------------------------------------
+ public static function text($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4)
+ {
+ $enc = QRencode::factory($level, $size, $margin);
+ return $enc->encode($text, $outfile);
+ }
+
+ //----------------------------------------------------------------------
+ public static function raw($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4)
+ {
+ $enc = QRencode::factory($level, $size, $margin);
+ return $enc->encodeRAW($text, $outfile);
+ }
+ }
+
+ //##########################################################################
+
+ class FrameFiller {
+
+ public $width;
+ public $frame;
+ public $x;
+ public $y;
+ public $dir;
+ public $bit;
+
+ //----------------------------------------------------------------------
+ public function __construct($width, &$frame)
+ {
+ $this->width = $width;
+ $this->frame = $frame;
+ $this->x = $width - 1;
+ $this->y = $width - 1;
+ $this->dir = -1;
+ $this->bit = -1;
+ }
+
+ //----------------------------------------------------------------------
+ public function setFrameAt($at, $val)
+ {
+ $this->frame[$at['y']][$at['x']] = chr($val);
+ }
+
+ //----------------------------------------------------------------------
+ public function getFrameAt($at)
+ {
+ return ord($this->frame[$at['y']][$at['x']]);
+ }
+
+ //----------------------------------------------------------------------
+ public function next()
+ {
+ do {
+
+ if($this->bit == -1) {
+ $this->bit = 0;
+ return array('x'=>$this->x, 'y'=>$this->y);
+ }
+
+ $x = $this->x;
+ $y = $this->y;
+ $w = $this->width;
+
+ if($this->bit == 0) {
+ $x--;
+ $this->bit++;
+ } else {
+ $x++;
+ $y += $this->dir;
+ $this->bit--;
+ }
+
+ if($this->dir < 0) {
+ if($y < 0) {
+ $y = 0;
+ $x -= 2;
+ $this->dir = 1;
+ if($x == 6) {
+ $x--;
+ $y = 9;
+ }
+ }
+ } else {
+ if($y == $w) {
+ $y = $w - 1;
+ $x -= 2;
+ $this->dir = -1;
+ if($x == 6) {
+ $x--;
+ $y -= 8;
+ }
+ }
+ }
+ if($x < 0 || $y < 0) return null;
+
+ $this->x = $x;
+ $this->y = $y;
+
+ } while(ord($this->frame[$y][$x]) & 0x80);
+
+ return array('x'=>$x, 'y'=>$y);
+ }
+
+ } ;
+
+ //##########################################################################
+
+ class QRencode {
+
+ public $casesensitive = true;
+ public $eightbit = false;
+
+ public $version = 0;
+ public $size = 3;
+ public $margin = 4;
+
+ public $structured = 0; // not supported yet
+
+ public $level = QR_ECLEVEL_L;
+ public $hint = QR_MODE_8;
+
+ //----------------------------------------------------------------------
+ public static function factory($level = QR_ECLEVEL_L, $size = 3, $margin = 4)
+ {
+ $enc = new QRencode();
+ $enc->size = $size;
+ $enc->margin = $margin;
+
+ switch ($level.'') {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ $enc->level = $level;
+ break;
+ case 'l':
+ case 'L':
+ $enc->level = QR_ECLEVEL_L;
+ break;
+ case 'm':
+ case 'M':
+ $enc->level = QR_ECLEVEL_M;
+ break;
+ case 'q':
+ case 'Q':
+ $enc->level = QR_ECLEVEL_Q;
+ break;
+ case 'h':
+ case 'H':
+ $enc->level = QR_ECLEVEL_H;
+ break;
+ }
+
+ return $enc;
+ }
+
+ //----------------------------------------------------------------------
+ public function encodeRAW($intext, $outfile = false)
+ {
+ $code = new QRcode();
+
+ if($this->eightbit) {
+ $code->encodeString8bit($intext, $this->version, $this->level);
+ } else {
+ $code->encodeString($intext, $this->version, $this->level, $this->hint, $this->casesensitive);
+ }
+
+ return $code->data;
+ }
+
+ //----------------------------------------------------------------------
+ public function encode($intext, $outfile = false)
+ {
+ $code = new QRcode();
+
+ if($this->eightbit) {
+ $code->encodeString8bit($intext, $this->version, $this->level);
+ } else {
+ $code->encodeString($intext, $this->version, $this->level, $this->hint, $this->casesensitive);
+ }
+
+ QRtools::markTime('after_encode');
+
+ if ($outfile!== false) {
+ file_put_contents($outfile, join("\n", QRtools::binarize($code->data)));
+ } else {
+ return QRtools::binarize($code->data);
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public function encodePNG($intext, $outfile = false,$saveAndPrint=false)
+ {
+ try {
+
+ ob_start();
+ $tab = $this->encode($intext);
+ $err = ob_get_contents();
+ ob_end_clean();
+
+ if ($err != '')
+ QRtools::log($outfile, $err);
+
+ $maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab)+2*$this->margin));
+
+ QRimage::png($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin,$saveAndPrint);
+
+ } catch (Exception $e) {
+
+ QRtools::log($outfile, $e->getMessage());
+
+ }
+ }
+
+ public function re_encodePNG($intext)
+ {
+ try {
+
+ ob_start();
+ $tab = $this->encode($intext);
+ $err = ob_get_contents();
+ ob_end_clean();
+
+ if ($err != '')
+ QRtools::log(false, $err);
+
+ $maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab) + 2 * $this->margin));
+
+ return QRimage::re_png($tab, min(max(1, $this->size), $maxSize), $this->margin);
+
+ } catch (Exception $e) {
+
+ QRtools::log(false, $e->getMessage());
+
+ }
+ }
+
+
+ }
+
+
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrbitstream.php b/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrbitstream.php
new file mode 100644
index 000000000..c8d116614
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrbitstream.php
@@ -0,0 +1,180 @@
+
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+ class QRbitstream {
+
+ public $data = array();
+
+ //----------------------------------------------------------------------
+ public function size()
+ {
+ return count($this->data);
+ }
+
+ //----------------------------------------------------------------------
+ public function allocate($setLength)
+ {
+ $this->data = array_fill(0, $setLength, 0);
+ return 0;
+ }
+
+ //----------------------------------------------------------------------
+ public static function newFromNum($bits, $num)
+ {
+ $bstream = new QRbitstream();
+ $bstream->allocate($bits);
+
+ $mask = 1 << ($bits - 1);
+ for($i=0; $i<$bits; $i++) {
+ if($num & $mask) {
+ $bstream->data[$i] = 1;
+ } else {
+ $bstream->data[$i] = 0;
+ }
+ $mask = $mask >> 1;
+ }
+
+ return $bstream;
+ }
+
+ //----------------------------------------------------------------------
+ public static function newFromBytes($size, $data)
+ {
+ $bstream = new QRbitstream();
+ $bstream->allocate($size * 8);
+ $p=0;
+
+ for($i=0; $i<$size; $i++) {
+ $mask = 0x80;
+ for($j=0; $j<8; $j++) {
+ if($data[$i] & $mask) {
+ $bstream->data[$p] = 1;
+ } else {
+ $bstream->data[$p] = 0;
+ }
+ $p++;
+ $mask = $mask >> 1;
+ }
+ }
+
+ return $bstream;
+ }
+
+ //----------------------------------------------------------------------
+ public function append(QRbitstream $arg)
+ {
+ if (is_null($arg)) {
+ return -1;
+ }
+
+ if($arg->size() == 0) {
+ return 0;
+ }
+
+ if($this->size() == 0) {
+ $this->data = $arg->data;
+ return 0;
+ }
+
+ $this->data = array_values(array_merge($this->data, $arg->data));
+
+ return 0;
+ }
+
+ //----------------------------------------------------------------------
+ public function appendNum($bits, $num)
+ {
+ if ($bits == 0)
+ return 0;
+
+ $b = QRbitstream::newFromNum($bits, $num);
+
+ if(is_null($b))
+ return -1;
+
+ $ret = $this->append($b);
+ unset($b);
+
+ return $ret;
+ }
+
+ //----------------------------------------------------------------------
+ public function appendBytes($size, $data)
+ {
+ if ($size == 0)
+ return 0;
+
+ $b = QRbitstream::newFromBytes($size, $data);
+
+ if(is_null($b))
+ return -1;
+
+ $ret = $this->append($b);
+ unset($b);
+
+ return $ret;
+ }
+
+ //----------------------------------------------------------------------
+ public function toByte()
+ {
+
+ $size = $this->size();
+
+ if($size == 0) {
+ return array();
+ }
+
+ $data = array_fill(0, (int)(($size + 7) / 8), 0);
+ $bytes = (int)($size / 8);
+
+ $p = 0;
+
+ for($i=0; $i<$bytes; $i++) {
+ $v = 0;
+ for($j=0; $j<8; $j++) {
+ $v = $v << 1;
+ $v |= $this->data[$p];
+ $p++;
+ }
+ $data[$i] = $v;
+ }
+
+ if($size & 7) {
+ $v = 0;
+ for($j=0; $j<($size & 7); $j++) {
+ $v = $v << 1;
+ $v |= $this->data[$p];
+ $p++;
+ }
+ $data[$bytes] = $v;
+ }
+
+ return $data;
+ }
+
+ }
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrconfig.php b/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrconfig.php
new file mode 100644
index 000000000..62e7f9745
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrconfig.php
@@ -0,0 +1,17 @@
+
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+ // Encoding modes
+ if(define('QR_MODE_NUL')){
+ define('QR_MODE_NUL', -1);
+ }
+
+ define('QR_MODE_NUM', 0);
+ define('QR_MODE_AN', 1);
+ define('QR_MODE_8', 2);
+ define('QR_MODE_KANJI', 3);
+ define('QR_MODE_STRUCTURE', 4);
+
+ // Levels of error correction.
+
+ define('QR_ECLEVEL_L', 0);
+ define('QR_ECLEVEL_M', 1);
+ define('QR_ECLEVEL_Q', 2);
+ define('QR_ECLEVEL_H', 3);
+
+ // Supported output formats
+
+ define('QR_FORMAT_TEXT', 0);
+ define('QR_FORMAT_PNG', 1);
+
+ class qrstr {
+ public static function set(&$srctab, $x, $y, $repl, $replLen = false) {
+ $srctab[$y] = substr_replace($srctab[$y], ($replLen !== false)?substr($repl,0,$replLen):$repl, $x, ($replLen !== false)?$replLen:strlen($repl));
+ }
+ }
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrencode.php b/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrencode.php
new file mode 100644
index 000000000..441972a31
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrencode.php
@@ -0,0 +1,502 @@
+
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+ class QRrsblock {
+ public $dataLength;
+ public $data = array();
+ public $eccLength;
+ public $ecc = array();
+
+ public function __construct($dl, $data, $el, &$ecc, QRrsItem $rs)
+ {
+ $rs->encode_rs_char($data, $ecc);
+
+ $this->dataLength = $dl;
+ $this->data = $data;
+ $this->eccLength = $el;
+ $this->ecc = $ecc;
+ }
+ };
+
+ //##########################################################################
+
+ class QRrawcode {
+ public $version;
+ public $datacode = array();
+ public $ecccode = array();
+ public $blocks;
+ public $rsblocks = array(); //of RSblock
+ public $count;
+ public $dataLength;
+ public $eccLength;
+ public $b1;
+
+ //----------------------------------------------------------------------
+ public function __construct(QRinput $input)
+ {
+ $spec = array(0,0,0,0,0);
+
+ $this->datacode = $input->getByteStream();
+ if(is_null($this->datacode)) {
+ throw new Exception('null imput string');
+ }
+
+ QRspec::getEccSpec($input->getVersion(), $input->getErrorCorrectionLevel(), $spec);
+
+ $this->version = $input->getVersion();
+ $this->b1 = QRspec::rsBlockNum1($spec);
+ $this->dataLength = QRspec::rsDataLength($spec);
+ $this->eccLength = QRspec::rsEccLength($spec);
+ $this->ecccode = array_fill(0, $this->eccLength, 0);
+ $this->blocks = QRspec::rsBlockNum($spec);
+
+ $ret = $this->init($spec);
+ if($ret < 0) {
+ throw new Exception('block alloc error');
+ return null;
+ }
+
+ $this->count = 0;
+ }
+
+ //----------------------------------------------------------------------
+ public function init(array $spec)
+ {
+ $dl = QRspec::rsDataCodes1($spec);
+ $el = QRspec::rsEccCodes1($spec);
+ $rs = QRrs::init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el);
+
+
+ $blockNo = 0;
+ $dataPos = 0;
+ $eccPos = 0;
+ for($i=0; $iecccode,$eccPos);
+ $this->rsblocks[$blockNo] = new QRrsblock($dl, array_slice($this->datacode, $dataPos), $el, $ecc, $rs);
+ $this->ecccode = array_merge(array_slice($this->ecccode,0, $eccPos), $ecc);
+
+ $dataPos += $dl;
+ $eccPos += $el;
+ $blockNo++;
+ }
+
+ if(QRspec::rsBlockNum2($spec) == 0)
+ return 0;
+
+ $dl = QRspec::rsDataCodes2($spec);
+ $el = QRspec::rsEccCodes2($spec);
+ $rs = QRrs::init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el);
+
+ if($rs == NULL) return -1;
+
+ for($i=0; $iecccode,$eccPos);
+ $this->rsblocks[$blockNo] = new QRrsblock($dl, array_slice($this->datacode, $dataPos), $el, $ecc, $rs);
+ $this->ecccode = array_merge(array_slice($this->ecccode,0, $eccPos), $ecc);
+
+ $dataPos += $dl;
+ $eccPos += $el;
+ $blockNo++;
+ }
+
+ return 0;
+ }
+
+ //----------------------------------------------------------------------
+ public function getCode()
+ {
+ $ret;
+
+ if($this->count < $this->dataLength) {
+ $row = $this->count % $this->blocks;
+ $col = $this->count / $this->blocks;
+ if($col >= $this->rsblocks[0]->dataLength) {
+ $row += $this->b1;
+ }
+ $ret = $this->rsblocks[$row]->data[$col];
+ } else if($this->count < $this->dataLength + $this->eccLength) {
+ $row = ($this->count - $this->dataLength) % $this->blocks;
+ $col = ($this->count - $this->dataLength) / $this->blocks;
+ $ret = $this->rsblocks[$row]->ecc[$col];
+ } else {
+ return 0;
+ }
+ $this->count++;
+
+ return $ret;
+ }
+ }
+
+ //##########################################################################
+
+ class QRcode {
+
+ public $version;
+ public $width;
+ public $data;
+
+ //----------------------------------------------------------------------
+ public function encodeMask(QRinput $input, $mask)
+ {
+ if($input->getVersion() < 0 || $input->getVersion() > QRSPEC_VERSION_MAX) {
+ throw new Exception('wrong version');
+ }
+ if($input->getErrorCorrectionLevel() > QR_ECLEVEL_H) {
+ throw new Exception('wrong level');
+ }
+
+ $raw = new QRrawcode($input);
+
+ QRtools::markTime('after_raw');
+
+ $version = $raw->version;
+ $width = QRspec::getWidth($version);
+ $frame = QRspec::newFrame($version);
+
+ $filler = new FrameFiller($width, $frame);
+ if(is_null($filler)) {
+ return NULL;
+ }
+
+ // inteleaved data and ecc codes
+ for($i=0; $i<$raw->dataLength + $raw->eccLength; $i++) {
+ $code = $raw->getCode();
+ $bit = 0x80;
+ for($j=0; $j<8; $j++) {
+ $addr = $filler->next();
+ $filler->setFrameAt($addr, 0x02 | (($bit & $code) != 0));
+ $bit = $bit >> 1;
+ }
+ }
+
+ QRtools::markTime('after_filler');
+
+ unset($raw);
+
+ // remainder bits
+ $j = QRspec::getRemainder($version);
+ for($i=0; $i<$j; $i++) {
+ $addr = $filler->next();
+ $filler->setFrameAt($addr, 0x02);
+ }
+
+ $frame = $filler->frame;
+ unset($filler);
+
+
+ // masking
+ $maskObj = new QRmask();
+ if($mask < 0) {
+
+ if (QR_FIND_BEST_MASK) {
+ $masked = $maskObj->mask($width, $frame, $input->getErrorCorrectionLevel());
+ } else {
+ $masked = $maskObj->makeMask($width, $frame, (intval(QR_DEFAULT_MASK) % 8), $input->getErrorCorrectionLevel());
+ }
+ } else {
+ $masked = $maskObj->makeMask($width, $frame, $mask, $input->getErrorCorrectionLevel());
+ }
+
+ if($masked == NULL) {
+ return NULL;
+ }
+
+ QRtools::markTime('after_mask');
+
+ $this->version = $version;
+ $this->width = $width;
+ $this->data = $masked;
+
+ return $this;
+ }
+
+ //----------------------------------------------------------------------
+ public function encodeInput(QRinput $input)
+ {
+ return $this->encodeMask($input, -1);
+ }
+
+ //----------------------------------------------------------------------
+ public function encodeString8bit($string, $version, $level)
+ {
+ if(string == NULL) {
+ throw new Exception('empty string!');
+ return NULL;
+ }
+
+ $input = new QRinput($version, $level);
+ if($input == NULL) return NULL;
+
+ $ret = $input->append($input, QR_MODE_8, strlen($string), str_split($string));
+ if($ret < 0) {
+ unset($input);
+ return NULL;
+ }
+ return $this->encodeInput($input);
+ }
+
+ //----------------------------------------------------------------------
+ public function encodeString($string, $version, $level, $hint, $casesensitive)
+ {
+
+ if($hint != QR_MODE_8 && $hint != QR_MODE_KANJI) {
+ throw new Exception('bad hint');
+ return NULL;
+ }
+
+ $input = new QRinput($version, $level);
+ if($input == NULL) return NULL;
+
+ $ret = QRsplit::splitStringToQRinput($string, $input, $hint, $casesensitive);
+ if($ret < 0) {
+ return NULL;
+ }
+
+ return $this->encodeInput($input);
+ }
+
+ //----------------------------------------------------------------------
+ public static function png($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4, $saveAndPrint=false)
+ {
+ $enc = QRencode::factory($level, $size, $margin);
+ return $enc->encodePNG($text, $outfile, $saveAndPrint=false);
+ }
+
+ //----------------------------------------------------------------------
+ public static function text($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4)
+ {
+ $enc = QRencode::factory($level, $size, $margin);
+ return $enc->encode($text, $outfile);
+ }
+
+ //----------------------------------------------------------------------
+ public static function raw($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4)
+ {
+ $enc = QRencode::factory($level, $size, $margin);
+ return $enc->encodeRAW($text, $outfile);
+ }
+ }
+
+ //##########################################################################
+
+ class FrameFiller {
+
+ public $width;
+ public $frame;
+ public $x;
+ public $y;
+ public $dir;
+ public $bit;
+
+ //----------------------------------------------------------------------
+ public function __construct($width, &$frame)
+ {
+ $this->width = $width;
+ $this->frame = $frame;
+ $this->x = $width - 1;
+ $this->y = $width - 1;
+ $this->dir = -1;
+ $this->bit = -1;
+ }
+
+ //----------------------------------------------------------------------
+ public function setFrameAt($at, $val)
+ {
+ $this->frame[$at['y']][$at['x']] = chr($val);
+ }
+
+ //----------------------------------------------------------------------
+ public function getFrameAt($at)
+ {
+ return ord($this->frame[$at['y']][$at['x']]);
+ }
+
+ //----------------------------------------------------------------------
+ public function next()
+ {
+ do {
+
+ if($this->bit == -1) {
+ $this->bit = 0;
+ return array('x'=>$this->x, 'y'=>$this->y);
+ }
+
+ $x = $this->x;
+ $y = $this->y;
+ $w = $this->width;
+
+ if($this->bit == 0) {
+ $x--;
+ $this->bit++;
+ } else {
+ $x++;
+ $y += $this->dir;
+ $this->bit--;
+ }
+
+ if($this->dir < 0) {
+ if($y < 0) {
+ $y = 0;
+ $x -= 2;
+ $this->dir = 1;
+ if($x == 6) {
+ $x--;
+ $y = 9;
+ }
+ }
+ } else {
+ if($y == $w) {
+ $y = $w - 1;
+ $x -= 2;
+ $this->dir = -1;
+ if($x == 6) {
+ $x--;
+ $y -= 8;
+ }
+ }
+ }
+ if($x < 0 || $y < 0) return null;
+
+ $this->x = $x;
+ $this->y = $y;
+
+ } while(ord($this->frame[$y][$x]) & 0x80);
+
+ return array('x'=>$x, 'y'=>$y);
+ }
+
+ } ;
+
+ //##########################################################################
+
+ class QRencode {
+
+ public $casesensitive = true;
+ public $eightbit = false;
+
+ public $version = 0;
+ public $size = 3;
+ public $margin = 4;
+
+ public $structured = 0; // not supported yet
+
+ public $level = QR_ECLEVEL_L;
+ public $hint = QR_MODE_8;
+
+ //----------------------------------------------------------------------
+ public static function factory($level = QR_ECLEVEL_L, $size = 3, $margin = 4)
+ {
+ $enc = new QRencode();
+ $enc->size = $size;
+ $enc->margin = $margin;
+
+ switch ($level.'') {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ $enc->level = $level;
+ break;
+ case 'l':
+ case 'L':
+ $enc->level = QR_ECLEVEL_L;
+ break;
+ case 'm':
+ case 'M':
+ $enc->level = QR_ECLEVEL_M;
+ break;
+ case 'q':
+ case 'Q':
+ $enc->level = QR_ECLEVEL_Q;
+ break;
+ case 'h':
+ case 'H':
+ $enc->level = QR_ECLEVEL_H;
+ break;
+ }
+
+ return $enc;
+ }
+
+ //----------------------------------------------------------------------
+ public function encodeRAW($intext, $outfile = false)
+ {
+ $code = new QRcode();
+
+ if($this->eightbit) {
+ $code->encodeString8bit($intext, $this->version, $this->level);
+ } else {
+ $code->encodeString($intext, $this->version, $this->level, $this->hint, $this->casesensitive);
+ }
+
+ return $code->data;
+ }
+
+ //----------------------------------------------------------------------
+ public function encode($intext, $outfile = false)
+ {
+ $code = new QRcode();
+
+ if($this->eightbit) {
+ $code->encodeString8bit($intext, $this->version, $this->level);
+ } else {
+ $code->encodeString($intext, $this->version, $this->level, $this->hint, $this->casesensitive);
+ }
+
+ QRtools::markTime('after_encode');
+
+ if ($outfile!== false) {
+ file_put_contents($outfile, join("\n", QRtools::binarize($code->data)));
+ } else {
+ return QRtools::binarize($code->data);
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public function encodePNG($intext, $outfile = false,$saveAndPrint=false)
+ {
+ try {
+
+ ob_start();
+ $tab = $this->encode($intext);
+ $err = ob_get_contents();
+ ob_end_clean();
+
+ if ($err != '')
+ QRtools::log($outfile, $err);
+
+ $maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab)+2*$this->margin));
+
+ QRimage::png($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin,$saveAndPrint);
+
+ } catch (Exception $e) {
+
+ QRtools::log($outfile, $e->getMessage());
+
+ }
+ }
+ }
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrimage.php b/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrimage.php
new file mode 100644
index 000000000..0bc1c3a31
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrimage.php
@@ -0,0 +1,95 @@
+
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+ define('QR_IMAGE', true);
+
+ class QRimage {
+
+ //----------------------------------------------------------------------
+ public static function png($frame, $filename = false, $pixelPerPoint = 4, $outerFrame = 4,$saveAndPrint=FALSE)
+ {
+ $image = self::image($frame, $pixelPerPoint, $outerFrame);
+
+ if ($filename === false) {
+ Header("Content-type: image/png");
+ ImagePng($image);
+ } else {
+ if($saveAndPrint===TRUE){
+ ImagePng($image, $filename);
+ header("Content-type: image/png");
+ ImagePng($image);
+ }else{
+ ImagePng($image, $filename);
+ }
+ }
+
+ ImageDestroy($image);
+ }
+
+ //----------------------------------------------------------------------
+ public static function jpg($frame, $filename = false, $pixelPerPoint = 8, $outerFrame = 4, $q = 85)
+ {
+ $image = self::image($frame, $pixelPerPoint, $outerFrame);
+
+ if ($filename === false) {
+ Header("Content-type: image/jpeg");
+ ImageJpeg($image, null, $q);
+ } else {
+ ImageJpeg($image, $filename, $q);
+ }
+
+ ImageDestroy($image);
+ }
+
+ //----------------------------------------------------------------------
+ private static function image($frame, $pixelPerPoint = 4, $outerFrame = 4)
+ {
+ $h = count($frame);
+ $w = strlen($frame[0]);
+
+ $imgW = $w + 2*$outerFrame;
+ $imgH = $h + 2*$outerFrame;
+
+ $base_image =ImageCreate($imgW, $imgH);
+
+ $col[0] = ImageColorAllocate($base_image,255,255,255);
+ $col[1] = ImageColorAllocate($base_image,0,0,0);
+
+ imagefill($base_image, 0, 0, $col[0]);
+
+ for($y=0; $y<$h; $y++) {
+ for($x=0; $x<$w; $x++) {
+ if ($frame[$y][$x] == '1') {
+ ImageSetPixel($base_image,$x+$outerFrame,$y+$outerFrame,$col[1]);
+ }
+ }
+ }
+
+ $target_image =ImageCreate($imgW * $pixelPerPoint, $imgH * $pixelPerPoint);
+ ImageCopyResized($target_image, $base_image, 0, 0, 0, 0, $imgW * $pixelPerPoint, $imgH * $pixelPerPoint, $imgW, $imgH);
+ ImageDestroy($base_image);
+
+ return $target_image;
+ }
+ }
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrinput.php b/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrinput.php
new file mode 100644
index 000000000..171558eee
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrinput.php
@@ -0,0 +1,729 @@
+
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+ define('STRUCTURE_HEADER_BITS', 20);
+ define('MAX_STRUCTURED_SYMBOLS', 16);
+
+ class QRinputItem {
+
+ public $mode;
+ public $size;
+ public $data;
+ public $bstream;
+
+ public function __construct($mode, $size, $data, $bstream = null)
+ {
+ $setData = array_slice($data, 0, $size);
+
+ if (count($setData) < $size) {
+ $setData = array_merge($setData, array_fill(0,$size-count($setData),0));
+ }
+
+ if(!QRinput::check($mode, $size, $setData)) {
+ throw new Exception('Error m:'.$mode.',s:'.$size.',d:'.join(',',$setData));
+ return null;
+ }
+
+ $this->mode = $mode;
+ $this->size = $size;
+ $this->data = $setData;
+ $this->bstream = $bstream;
+ }
+
+ //----------------------------------------------------------------------
+ public function encodeModeNum($version)
+ {
+ try {
+
+ $words = (int)($this->size / 3);
+ $bs = new QRbitstream();
+
+ $val = 0x1;
+ $bs->appendNum(4, $val);
+ $bs->appendNum(QRspec::lengthIndicator(QR_MODE_NUM, $version), $this->size);
+
+ for($i=0; $i<$words; $i++) {
+ $val = (ord($this->data[$i*3 ]) - ord('0')) * 100;
+ $val += (ord($this->data[$i*3+1]) - ord('0')) * 10;
+ $val += (ord($this->data[$i*3+2]) - ord('0'));
+ $bs->appendNum(10, $val);
+ }
+
+ if($this->size - $words * 3 == 1) {
+ $val = ord($this->data[$words*3]) - ord('0');
+ $bs->appendNum(4, $val);
+ } else if($this->size - $words * 3 == 2) {
+ $val = (ord($this->data[$words*3 ]) - ord('0')) * 10;
+ $val += (ord($this->data[$words*3+1]) - ord('0'));
+ $bs->appendNum(7, $val);
+ }
+
+ $this->bstream = $bs;
+ return 0;
+
+ } catch (Exception $e) {
+ return -1;
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public function encodeModeAn($version)
+ {
+ try {
+ $words = (int)($this->size / 2);
+ $bs = new QRbitstream();
+
+ $bs->appendNum(4, 0x02);
+ $bs->appendNum(QRspec::lengthIndicator(QR_MODE_AN, $version), $this->size);
+
+ for($i=0; $i<$words; $i++) {
+ $val = (int)QRinput::lookAnTable(ord($this->data[$i*2 ])) * 45;
+ $val += (int)QRinput::lookAnTable(ord($this->data[$i*2+1]));
+
+ $bs->appendNum(11, $val);
+ }
+
+ if($this->size & 1) {
+ $val = QRinput::lookAnTable(ord($this->data[$words * 2]));
+ $bs->appendNum(6, $val);
+ }
+
+ $this->bstream = $bs;
+ return 0;
+
+ } catch (Exception $e) {
+ return -1;
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public function encodeMode8($version)
+ {
+ try {
+ $bs = new QRbitstream();
+
+ $bs->appendNum(4, 0x4);
+ $bs->appendNum(QRspec::lengthIndicator(QR_MODE_8, $version), $this->size);
+
+ for($i=0; $i<$this->size; $i++) {
+ $bs->appendNum(8, ord($this->data[$i]));
+ }
+
+ $this->bstream = $bs;
+ return 0;
+
+ } catch (Exception $e) {
+ return -1;
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public function encodeModeKanji($version)
+ {
+ try {
+
+ $bs = new QRbitrtream();
+
+ $bs->appendNum(4, 0x8);
+ $bs->appendNum(QRspec::lengthIndicator(QR_MODE_KANJI, $version), (int)($this->size / 2));
+
+ for($i=0; $i<$this->size; $i+=2) {
+ $val = (ord($this->data[$i]) << 8) | ord($this->data[$i+1]);
+ if($val <= 0x9ffc) {
+ $val -= 0x8140;
+ } else {
+ $val -= 0xc140;
+ }
+
+ $h = ($val >> 8) * 0xc0;
+ $val = ($val & 0xff) + $h;
+
+ $bs->appendNum(13, $val);
+ }
+
+ $this->bstream = $bs;
+ return 0;
+
+ } catch (Exception $e) {
+ return -1;
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public function encodeModeStructure()
+ {
+ try {
+ $bs = new QRbitstream();
+
+ $bs->appendNum(4, 0x03);
+ $bs->appendNum(4, ord($this->data[1]) - 1);
+ $bs->appendNum(4, ord($this->data[0]) - 1);
+ $bs->appendNum(8, ord($this->data[2]));
+
+ $this->bstream = $bs;
+ return 0;
+
+ } catch (Exception $e) {
+ return -1;
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public function estimateBitStreamSizeOfEntry($version)
+ {
+ $bits = 0;
+
+ if($version == 0)
+ $version = 1;
+
+ switch($this->mode) {
+ case QR_MODE_NUM: $bits = QRinput::estimateBitsModeNum($this->size); break;
+ case QR_MODE_AN: $bits = QRinput::estimateBitsModeAn($this->size); break;
+ case QR_MODE_8: $bits = QRinput::estimateBitsMode8($this->size); break;
+ case QR_MODE_KANJI: $bits = QRinput::estimateBitsModeKanji($this->size);break;
+ case QR_MODE_STRUCTURE: return STRUCTURE_HEADER_BITS;
+ default:
+ return 0;
+ }
+
+ $l = QRspec::lengthIndicator($this->mode, $version);
+ $m = 1 << $l;
+ $num = (int)(($this->size + $m - 1) / $m);
+
+ $bits += $num * (4 + $l);
+
+ return $bits;
+ }
+
+ //----------------------------------------------------------------------
+ public function encodeBitStream($version)
+ {
+ try {
+
+ unset($this->bstream);
+ $words = QRspec::maximumWords($this->mode, $version);
+
+ if($this->size > $words) {
+
+ $st1 = new QRinputItem($this->mode, $words, $this->data);
+ $st2 = new QRinputItem($this->mode, $this->size - $words, array_slice($this->data, $words));
+
+ $st1->encodeBitStream($version);
+ $st2->encodeBitStream($version);
+
+ $this->bstream = new QRbitstream();
+ $this->bstream->append($st1->bstream);
+ $this->bstream->append($st2->bstream);
+
+ unset($st1);
+ unset($st2);
+
+ } else {
+
+ $ret = 0;
+
+ switch($this->mode) {
+ case QR_MODE_NUM: $ret = $this->encodeModeNum($version); break;
+ case QR_MODE_AN: $ret = $this->encodeModeAn($version); break;
+ case QR_MODE_8: $ret = $this->encodeMode8($version); break;
+ case QR_MODE_KANJI: $ret = $this->encodeModeKanji($version);break;
+ case QR_MODE_STRUCTURE: $ret = $this->encodeModeStructure(); break;
+
+ default:
+ break;
+ }
+
+ if($ret < 0)
+ return -1;
+ }
+
+ return $this->bstream->size();
+
+ } catch (Exception $e) {
+ return -1;
+ }
+ }
+ };
+
+ //##########################################################################
+
+ class QRinput {
+
+ public $items;
+
+ private $version;
+ private $level;
+
+ //----------------------------------------------------------------------
+ public function __construct($version = 0, $level = QR_ECLEVEL_L)
+ {
+ if ($version < 0 || $version > QRSPEC_VERSION_MAX || $level > QR_ECLEVEL_H) {
+ throw new Exception('Invalid version no');
+ return NULL;
+ }
+
+ $this->version = $version;
+ $this->level = $level;
+ }
+
+ //----------------------------------------------------------------------
+ public function getVersion()
+ {
+ return $this->version;
+ }
+
+ //----------------------------------------------------------------------
+ public function setVersion($version)
+ {
+ if($version < 0 || $version > QRSPEC_VERSION_MAX) {
+ throw new Exception('Invalid version no');
+ return -1;
+ }
+
+ $this->version = $version;
+
+ return 0;
+ }
+
+ //----------------------------------------------------------------------
+ public function getErrorCorrectionLevel()
+ {
+ return $this->level;
+ }
+
+ //----------------------------------------------------------------------
+ public function setErrorCorrectionLevel($level)
+ {
+ if($level > QR_ECLEVEL_H) {
+ throw new Exception('Invalid ECLEVEL');
+ return -1;
+ }
+
+ $this->level = $level;
+
+ return 0;
+ }
+
+ //----------------------------------------------------------------------
+ public function appendEntry(QRinputItem $entry)
+ {
+ $this->items[] = $entry;
+ }
+
+ //----------------------------------------------------------------------
+ public function append($mode, $size, $data)
+ {
+ try {
+ $entry = new QRinputItem($mode, $size, $data);
+ $this->items[] = $entry;
+ return 0;
+ } catch (Exception $e) {
+ return -1;
+ }
+ }
+
+ //----------------------------------------------------------------------
+
+ public function insertStructuredAppendHeader($size, $index, $parity)
+ {
+ if( $size > MAX_STRUCTURED_SYMBOLS ) {
+ throw new Exception('insertStructuredAppendHeader wrong size');
+ }
+
+ if( $index <= 0 || $index > MAX_STRUCTURED_SYMBOLS ) {
+ throw new Exception('insertStructuredAppendHeader wrong index');
+ }
+
+ $buf = array($size, $index, $parity);
+
+ try {
+ $entry = new QRinputItem(QR_MODE_STRUCTURE, 3, buf);
+ array_unshift($this->items, $entry);
+ return 0;
+ } catch (Exception $e) {
+ return -1;
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public function calcParity()
+ {
+ $parity = 0;
+
+ foreach($this->items as $item) {
+ if($item->mode != QR_MODE_STRUCTURE) {
+ for($i=$item->size-1; $i>=0; $i--) {
+ $parity ^= $item->data[$i];
+ }
+ }
+ }
+
+ return $parity;
+ }
+
+ //----------------------------------------------------------------------
+ public static function checkModeNum($size, $data)
+ {
+ for($i=0; $i<$size; $i++) {
+ if((ord($data[$i]) < ord('0')) || (ord($data[$i]) > ord('9'))){
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ //----------------------------------------------------------------------
+ public static function estimateBitsModeNum($size)
+ {
+ $w = (int)$size / 3;
+ $bits = $w * 10;
+
+ switch($size - $w * 3) {
+ case 1:
+ $bits += 4;
+ break;
+ case 2:
+ $bits += 7;
+ break;
+ default:
+ break;
+ }
+
+ return $bits;
+ }
+
+ //----------------------------------------------------------------------
+ public static $anTable = array(
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1,
+ -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+ );
+
+ //----------------------------------------------------------------------
+ public static function lookAnTable($c)
+ {
+ return (($c > 127)?-1:self::$anTable[$c]);
+ }
+
+ //----------------------------------------------------------------------
+ public static function checkModeAn($size, $data)
+ {
+ for($i=0; $i<$size; $i++) {
+ if (self::lookAnTable(ord($data[$i])) == -1) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ //----------------------------------------------------------------------
+ public static function estimateBitsModeAn($size)
+ {
+ $w = (int)($size / 2);
+ $bits = $w * 11;
+
+ if($size & 1) {
+ $bits += 6;
+ }
+
+ return $bits;
+ }
+
+ //----------------------------------------------------------------------
+ public static function estimateBitsMode8($size)
+ {
+ return $size * 8;
+ }
+
+ //----------------------------------------------------------------------
+ public function estimateBitsModeKanji($size)
+ {
+ return (int)(($size / 2) * 13);
+ }
+
+ //----------------------------------------------------------------------
+ public static function checkModeKanji($size, $data)
+ {
+ if($size & 1)
+ return false;
+
+ for($i=0; $i<$size; $i+=2) {
+ $val = (ord($data[$i]) << 8) | ord($data[$i+1]);
+ if( $val < 0x8140
+ || ($val > 0x9ffc && $val < 0xe040)
+ || $val > 0xebbf) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /***********************************************************************
+ * Validation
+ **********************************************************************/
+
+ public static function check($mode, $size, $data)
+ {
+ if($size <= 0)
+ return false;
+
+ switch($mode) {
+ case QR_MODE_NUM: return self::checkModeNum($size, $data); break;
+ case QR_MODE_AN: return self::checkModeAn($size, $data); break;
+ case QR_MODE_KANJI: return self::checkModeKanji($size, $data); break;
+ case QR_MODE_8: return true; break;
+ case QR_MODE_STRUCTURE: return true; break;
+
+ default:
+ break;
+ }
+
+ return false;
+ }
+
+
+ //----------------------------------------------------------------------
+ public function estimateBitStreamSize($version)
+ {
+ $bits = 0;
+
+ foreach($this->items as $item) {
+ $bits += $item->estimateBitStreamSizeOfEntry($version);
+ }
+
+ return $bits;
+ }
+
+ //----------------------------------------------------------------------
+ public function estimateVersion()
+ {
+ $version = 0;
+ $prev = 0;
+ do {
+ $prev = $version;
+ $bits = $this->estimateBitStreamSize($prev);
+ $version = QRspec::getMinimumVersion((int)(($bits + 7) / 8), $this->level);
+ if ($version < 0) {
+ return -1;
+ }
+ } while ($version > $prev);
+
+ return $version;
+ }
+
+ //----------------------------------------------------------------------
+ public static function lengthOfCode($mode, $version, $bits)
+ {
+ $payload = $bits - 4 - QRspec::lengthIndicator($mode, $version);
+ switch($mode) {
+ case QR_MODE_NUM:
+ $chunks = (int)($payload / 10);
+ $remain = $payload - $chunks * 10;
+ $size = $chunks * 3;
+ if($remain >= 7) {
+ $size += 2;
+ } else if($remain >= 4) {
+ $size += 1;
+ }
+ break;
+ case QR_MODE_AN:
+ $chunks = (int)($payload / 11);
+ $remain = $payload - $chunks * 11;
+ $size = $chunks * 2;
+ if($remain >= 6)
+ $size++;
+ break;
+ case QR_MODE_8:
+ $size = (int)($payload / 8);
+ break;
+ case QR_MODE_KANJI:
+ $size = (int)(($payload / 13) * 2);
+ break;
+ case QR_MODE_STRUCTURE:
+ $size = (int)($payload / 8);
+ break;
+ default:
+ $size = 0;
+ break;
+ }
+
+ $maxsize = QRspec::maximumWords($mode, $version);
+ if($size < 0) $size = 0;
+ if($size > $maxsize) $size = $maxsize;
+
+ return $size;
+ }
+
+ //----------------------------------------------------------------------
+ public function createBitStream()
+ {
+ $total = 0;
+
+ foreach($this->items as $item) {
+ $bits = $item->encodeBitStream($this->version);
+
+ if($bits < 0)
+ return -1;
+
+ $total += $bits;
+ }
+
+ return $total;
+ }
+
+ //----------------------------------------------------------------------
+ public function convertData()
+ {
+ $ver = $this->estimateVersion();
+ if($ver > $this->getVersion()) {
+ $this->setVersion($ver);
+ }
+
+ for(;;) {
+ $bits = $this->createBitStream();
+
+ if($bits < 0)
+ return -1;
+
+ $ver = QRspec::getMinimumVersion((int)(($bits + 7) / 8), $this->level);
+ if($ver < 0) {
+ throw new Exception('WRONG VERSION');
+ return -1;
+ } else if($ver > $this->getVersion()) {
+ $this->setVersion($ver);
+ } else {
+ break;
+ }
+ }
+
+ return 0;
+ }
+
+ //----------------------------------------------------------------------
+ public function appendPaddingBit(&$bstream)
+ {
+ $bits = $bstream->size();
+ $maxwords = QRspec::getDataLength($this->version, $this->level);
+ $maxbits = $maxwords * 8;
+
+ if ($maxbits == $bits) {
+ return 0;
+ }
+
+ if ($maxbits - $bits < 5) {
+ return $bstream->appendNum($maxbits - $bits, 0);
+ }
+
+ $bits += 4;
+ $words = (int)(($bits + 7) / 8);
+
+ $padding = new QRbitstream();
+ $ret = $padding->appendNum($words * 8 - $bits + 4, 0);
+
+ if($ret < 0)
+ return $ret;
+
+ $padlen = $maxwords - $words;
+
+ if($padlen > 0) {
+
+ $padbuf = array();
+ for($i=0; $i<$padlen; $i++) {
+ $padbuf[$i] = ($i&1)?0x11:0xec;
+ }
+
+ $ret = $padding->appendBytes($padlen, $padbuf);
+
+ if($ret < 0)
+ return $ret;
+
+ }
+
+ $ret = $bstream->append($padding);
+
+ return $ret;
+ }
+
+ //----------------------------------------------------------------------
+ public function mergeBitStream()
+ {
+ if($this->convertData() < 0) {
+ return null;
+ }
+
+ $bstream = new QRbitstream();
+
+ foreach($this->items as $item) {
+ $ret = $bstream->append($item->bstream);
+ if($ret < 0) {
+ return null;
+ }
+ }
+
+ return $bstream;
+ }
+
+ //----------------------------------------------------------------------
+ public function getBitStream()
+ {
+
+ $bstream = $this->mergeBitStream();
+
+ if($bstream == null) {
+ return null;
+ }
+
+ $ret = $this->appendPaddingBit($bstream);
+ if($ret < 0) {
+ return null;
+ }
+
+ return $bstream;
+ }
+
+ //----------------------------------------------------------------------
+ public function getByteStream()
+ {
+ $bstream = $this->getBitStream();
+ if($bstream == null) {
+ return null;
+ }
+
+ return $bstream->toByte();
+ }
+ }
+
+
+
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrlib.php b/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrlib.php
new file mode 100644
index 000000000..43059b9de
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrlib.php
@@ -0,0 +1,43 @@
+
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+ $QR_BASEDIR = dirname(__FILE__).DIRECTORY_SEPARATOR;
+
+ // Required libs
+
+ include $QR_BASEDIR."qrconst.php";
+ include $QR_BASEDIR."qrconfig.php";
+ include $QR_BASEDIR."qrtools.php";
+ include $QR_BASEDIR."qrspec.php";
+ include $QR_BASEDIR."qrimage.php";
+ include $QR_BASEDIR."qrinput.php";
+ include $QR_BASEDIR."qrbitstream.php";
+ include $QR_BASEDIR."qrsplit.php";
+ include $QR_BASEDIR."qrrscode.php";
+ include $QR_BASEDIR."qrmask.php";
+ include $QR_BASEDIR."qrencode.php";
+
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrmask.php b/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrmask.php
new file mode 100644
index 000000000..2d388e0ea
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrmask.php
@@ -0,0 +1,328 @@
+
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+ define('N1', 3);
+ define('N2', 3);
+ define('N3', 40);
+ define('N4', 10);
+
+ class QRmask {
+
+ public $runLength = array();
+
+ //----------------------------------------------------------------------
+ public function __construct()
+ {
+ $this->runLength = array_fill(0, QRSPEC_WIDTH_MAX + 1, 0);
+ }
+
+ //----------------------------------------------------------------------
+ public function writeFormatInformation($width, &$frame, $mask, $level)
+ {
+ $blacks = 0;
+ $format = QRspec::getFormatInfo($mask, $level);
+
+ for($i=0; $i<8; $i++) {
+ if($format & 1) {
+ $blacks += 2;
+ $v = 0x85;
+ } else {
+ $v = 0x84;
+ }
+
+ $frame[8][$width - 1 - $i] = chr($v);
+ if($i < 6) {
+ $frame[$i][8] = chr($v);
+ } else {
+ $frame[$i + 1][8] = chr($v);
+ }
+ $format = $format >> 1;
+ }
+
+ for($i=0; $i<7; $i++) {
+ if($format & 1) {
+ $blacks += 2;
+ $v = 0x85;
+ } else {
+ $v = 0x84;
+ }
+
+ $frame[$width - 7 + $i][8] = chr($v);
+ if($i == 0) {
+ $frame[8][7] = chr($v);
+ } else {
+ $frame[8][6 - $i] = chr($v);
+ }
+
+ $format = $format >> 1;
+ }
+
+ return $blacks;
+ }
+
+ //----------------------------------------------------------------------
+ public function mask0($x, $y) { return ($x+$y)&1; }
+ public function mask1($x, $y) { return ($y&1); }
+ public function mask2($x, $y) { return ($x%3); }
+ public function mask3($x, $y) { return ($x+$y)%3; }
+ public function mask4($x, $y) { return (((int)($y/2))+((int)($x/3)))&1; }
+ public function mask5($x, $y) { return (($x*$y)&1)+($x*$y)%3; }
+ public function mask6($x, $y) { return ((($x*$y)&1)+($x*$y)%3)&1; }
+ public function mask7($x, $y) { return ((($x*$y)%3)+(($x+$y)&1))&1; }
+
+ //----------------------------------------------------------------------
+ private function generateMaskNo($maskNo, $width, $frame)
+ {
+ $bitMask = array_fill(0, $width, array_fill(0, $width, 0));
+
+ for($y=0; $y<$width; $y++) {
+ for($x=0; $x<$width; $x++) {
+ if(ord($frame[$y][$x]) & 0x80) {
+ $bitMask[$y][$x] = 0;
+ } else {
+ $maskFunc = call_user_func(array($this, 'mask'.$maskNo), $x, $y);
+ $bitMask[$y][$x] = ($maskFunc == 0)?1:0;
+ }
+
+ }
+ }
+
+ return $bitMask;
+ }
+
+ //----------------------------------------------------------------------
+ public static function serial($bitFrame)
+ {
+ $codeArr = array();
+
+ foreach ($bitFrame as $line)
+ $codeArr[] = join('', $line);
+
+ return gzcompress(join("\n", $codeArr), 9);
+ }
+
+ //----------------------------------------------------------------------
+ public static function unserial($code)
+ {
+ $codeArr = array();
+
+ $codeLines = explode("\n", gzuncompress($code));
+ foreach ($codeLines as $line)
+ $codeArr[] = str_split($line);
+
+ return $codeArr;
+ }
+
+ //----------------------------------------------------------------------
+ public function makeMaskNo($maskNo, $width, $s, &$d, $maskGenOnly = false)
+ {
+ $b = 0;
+ $bitMask = array();
+
+ $fileName = QR_CACHE_DIR.'mask_'.$maskNo.DIRECTORY_SEPARATOR.'mask_'.$width.'_'.$maskNo.'.dat';
+
+ if (QR_CACHEABLE) {
+ if (file_exists($fileName)) {
+ $bitMask = self::unserial(file_get_contents($fileName));
+ } else {
+ $bitMask = $this->generateMaskNo($maskNo, $width, $s, $d);
+ if (!file_exists(QR_CACHE_DIR.'mask_'.$maskNo))
+ mkdir(QR_CACHE_DIR.'mask_'.$maskNo);
+ file_put_contents($fileName, self::serial($bitMask));
+ }
+ } else {
+ $bitMask = $this->generateMaskNo($maskNo, $width, $s, $d);
+ }
+
+ if ($maskGenOnly)
+ return;
+
+ $d = $s;
+
+ for($y=0; $y<$width; $y++) {
+ for($x=0; $x<$width; $x++) {
+ if($bitMask[$y][$x] == 1) {
+ $d[$y][$x] = chr(ord($s[$y][$x]) ^ (int)$bitMask[$y][$x]);
+ }
+ $b += (int)(ord($d[$y][$x]) & 1);
+ }
+ }
+
+ return $b;
+ }
+
+ //----------------------------------------------------------------------
+ public function makeMask($width, $frame, $maskNo, $level)
+ {
+ $masked = array_fill(0, $width, str_repeat("\0", $width));
+ $this->makeMaskNo($maskNo, $width, $frame, $masked);
+ $this->writeFormatInformation($width, $masked, $maskNo, $level);
+
+ return $masked;
+ }
+
+ //----------------------------------------------------------------------
+ public function calcN1N3($length)
+ {
+ $demerit = 0;
+
+ for($i=0; $i<$length; $i++) {
+
+ if($this->runLength[$i] >= 5) {
+ $demerit += (N1 + ($this->runLength[$i] - 5));
+ }
+ if($i & 1) {
+ if(($i >= 3) && ($i < ($length-2)) && ($this->runLength[$i] % 3 == 0)) {
+ $fact = (int)($this->runLength[$i] / 3);
+ if(($this->runLength[$i-2] == $fact) &&
+ ($this->runLength[$i-1] == $fact) &&
+ ($this->runLength[$i+1] == $fact) &&
+ ($this->runLength[$i+2] == $fact)) {
+ if(($this->runLength[$i-3] < 0) || ($this->runLength[$i-3] >= (4 * $fact))) {
+ $demerit += N3;
+ } else if((($i+3) >= $length) || ($this->runLength[$i+3] >= (4 * $fact))) {
+ $demerit += N3;
+ }
+ }
+ }
+ }
+ }
+ return $demerit;
+ }
+
+ //----------------------------------------------------------------------
+ public function evaluateSymbol($width, $frame)
+ {
+ $head = 0;
+ $demerit = 0;
+
+ for($y=0; $y<$width; $y++) {
+ $head = 0;
+ $this->runLength[0] = 1;
+
+ $frameY = $frame[$y];
+
+ if ($y>0)
+ $frameYM = $frame[$y-1];
+
+ for($x=0; $x<$width; $x++) {
+ if(($x > 0) && ($y > 0)) {
+ $b22 = ord($frameY[$x]) & ord($frameY[$x-1]) & ord($frameYM[$x]) & ord($frameYM[$x-1]);
+ $w22 = ord($frameY[$x]) | ord($frameY[$x-1]) | ord($frameYM[$x]) | ord($frameYM[$x-1]);
+
+ if(($b22 | ($w22 ^ 1))&1) {
+ $demerit += N2;
+ }
+ }
+ if(($x == 0) && (ord($frameY[$x]) & 1)) {
+ $this->runLength[0] = -1;
+ $head = 1;
+ $this->runLength[$head] = 1;
+ } else if($x > 0) {
+ if((ord($frameY[$x]) ^ ord($frameY[$x-1])) & 1) {
+ $head++;
+ $this->runLength[$head] = 1;
+ } else {
+ $this->runLength[$head]++;
+ }
+ }
+ }
+
+ $demerit += $this->calcN1N3($head+1);
+ }
+
+ for($x=0; $x<$width; $x++) {
+ $head = 0;
+ $this->runLength[0] = 1;
+
+ for($y=0; $y<$width; $y++) {
+ if($y == 0 && (ord($frame[$y][$x]) & 1)) {
+ $this->runLength[0] = -1;
+ $head = 1;
+ $this->runLength[$head] = 1;
+ } else if($y > 0) {
+ if((ord($frame[$y][$x]) ^ ord($frame[$y-1][$x])) & 1) {
+ $head++;
+ $this->runLength[$head] = 1;
+ } else {
+ $this->runLength[$head]++;
+ }
+ }
+ }
+
+ $demerit += $this->calcN1N3($head+1);
+ }
+
+ return $demerit;
+ }
+
+
+ //----------------------------------------------------------------------
+ public function mask($width, $frame, $level)
+ {
+ $minDemerit = PHP_INT_MAX;
+ $bestMaskNum = 0;
+ $bestMask = array();
+
+ $checked_masks = array(0,1,2,3,4,5,6,7);
+
+ if (QR_FIND_FROM_RANDOM !== false) {
+
+ $howManuOut = 8-(QR_FIND_FROM_RANDOM % 9);
+ for ($i = 0; $i < $howManuOut; $i++) {
+ $remPos = rand (0, count($checked_masks)-1);
+ unset($checked_masks[$remPos]);
+ $checked_masks = array_values($checked_masks);
+ }
+
+ }
+
+ $bestMask = $frame;
+
+ foreach($checked_masks as $i) {
+ $mask = array_fill(0, $width, str_repeat("\0", $width));
+
+ $demerit = 0;
+ $blacks = 0;
+ $blacks = $this->makeMaskNo($i, $width, $frame, $mask);
+ $blacks += $this->writeFormatInformation($width, $mask, $i, $level);
+ $blacks = (int)(100 * $blacks / ($width * $width));
+ $demerit = (int)((int)(abs($blacks - 50) / 5) * N4);
+ $demerit += $this->evaluateSymbol($width, $mask);
+
+ if($demerit < $minDemerit) {
+ $minDemerit = $demerit;
+ $bestMask = $mask;
+ $bestMaskNum = $i;
+ }
+ }
+
+ return $bestMask;
+ }
+
+ //----------------------------------------------------------------------
+ }
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrrscode.php b/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrrscode.php
new file mode 100644
index 000000000..d7a97d9a1
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrrscode.php
@@ -0,0 +1,210 @@
+
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+ class QRrsItem {
+
+ public $mm; // Bits per symbol
+ public $nn; // Symbols per block (= (1<= $this->nn) {
+ $x -= $this->nn;
+ $x = ($x >> $this->mm) + ($x & $this->nn);
+ }
+
+ return $x;
+ }
+
+ //----------------------------------------------------------------------
+ public static function init_rs_char($symsize, $gfpoly, $fcr, $prim, $nroots, $pad)
+ {
+ // Common code for intializing a Reed-Solomon control block (char or int symbols)
+ // Copyright 2004 Phil Karn, KA9Q
+ // May be used under the terms of the GNU Lesser General Public License (LGPL)
+
+ $rs = null;
+
+ // Check parameter ranges
+ if($symsize < 0 || $symsize > 8) return $rs;
+ if($fcr < 0 || $fcr >= (1<<$symsize)) return $rs;
+ if($prim <= 0 || $prim >= (1<<$symsize)) return $rs;
+ if($nroots < 0 || $nroots >= (1<<$symsize)) return $rs; // Can't have more roots than symbol values!
+ if($pad < 0 || $pad >= ((1<<$symsize) -1 - $nroots)) return $rs; // Too much padding
+
+ $rs = new QRrsItem();
+ $rs->mm = $symsize;
+ $rs->nn = (1<<$symsize)-1;
+ $rs->pad = $pad;
+
+ $rs->alpha_to = array_fill(0, $rs->nn+1, 0);
+ $rs->index_of = array_fill(0, $rs->nn+1, 0);
+
+ // PHP style macro replacement ;)
+ $NN =& $rs->nn;
+ $A0 =& $NN;
+
+ // Generate Galois field lookup tables
+ $rs->index_of[0] = $A0; // log(zero) = -inf
+ $rs->alpha_to[$A0] = 0; // alpha**-inf = 0
+ $sr = 1;
+
+ for($i=0; $i<$rs->nn; $i++) {
+ $rs->index_of[$sr] = $i;
+ $rs->alpha_to[$i] = $sr;
+ $sr <<= 1;
+ if($sr & (1<<$symsize)) {
+ $sr ^= $gfpoly;
+ }
+ $sr &= $rs->nn;
+ }
+
+ if($sr != 1){
+ // field generator polynomial is not primitive!
+ $rs = NULL;
+ return $rs;
+ }
+
+ /* Form RS code generator polynomial from its roots */
+ $rs->genpoly = array_fill(0, $nroots+1, 0);
+
+ $rs->fcr = $fcr;
+ $rs->prim = $prim;
+ $rs->nroots = $nroots;
+ $rs->gfpoly = $gfpoly;
+
+ /* Find prim-th root of 1, used in decoding */
+ for($iprim=1;($iprim % $prim) != 0;$iprim += $rs->nn)
+ ; // intentional empty-body loop!
+
+ $rs->iprim = (int)($iprim / $prim);
+ $rs->genpoly[0] = 1;
+
+ for ($i = 0,$root=$fcr*$prim; $i < $nroots; $i++, $root += $prim) {
+ $rs->genpoly[$i+1] = 1;
+
+ // Multiply rs->genpoly[] by @**(root + x)
+ for ($j = $i; $j > 0; $j--) {
+ if ($rs->genpoly[$j] != 0) {
+ $rs->genpoly[$j] = $rs->genpoly[$j-1] ^ $rs->alpha_to[$rs->modnn($rs->index_of[$rs->genpoly[$j]] + $root)];
+ } else {
+ $rs->genpoly[$j] = $rs->genpoly[$j-1];
+ }
+ }
+ // rs->genpoly[0] can never be zero
+ $rs->genpoly[0] = $rs->alpha_to[$rs->modnn($rs->index_of[$rs->genpoly[0]] + $root)];
+ }
+
+ // convert rs->genpoly[] to index form for quicker encoding
+ for ($i = 0; $i <= $nroots; $i++)
+ $rs->genpoly[$i] = $rs->index_of[$rs->genpoly[$i]];
+
+ return $rs;
+ }
+
+ //----------------------------------------------------------------------
+ public function encode_rs_char($data, &$parity)
+ {
+ $MM =& $this->mm;
+ $NN =& $this->nn;
+ $ALPHA_TO =& $this->alpha_to;
+ $INDEX_OF =& $this->index_of;
+ $GENPOLY =& $this->genpoly;
+ $NROOTS =& $this->nroots;
+ $FCR =& $this->fcr;
+ $PRIM =& $this->prim;
+ $IPRIM =& $this->iprim;
+ $PAD =& $this->pad;
+ $A0 =& $NN;
+
+ $parity = array_fill(0, $NROOTS, 0);
+
+ for($i=0; $i< ($NN-$NROOTS-$PAD); $i++) {
+
+ $feedback = $INDEX_OF[$data[$i] ^ $parity[0]];
+ if($feedback != $A0) {
+ // feedback term is non-zero
+
+ // This line is unnecessary when GENPOLY[NROOTS] is unity, as it must
+ // always be for the polynomials constructed by init_rs()
+ $feedback = $this->modnn($NN - $GENPOLY[$NROOTS] + $feedback);
+
+ for($j=1;$j<$NROOTS;$j++) {
+ $parity[$j] ^= $ALPHA_TO[$this->modnn($feedback + $GENPOLY[$NROOTS-$j])];
+ }
+ }
+
+ // Shift
+ array_shift($parity);
+ if($feedback != $A0) {
+ array_push($parity, $ALPHA_TO[$this->modnn($feedback + $GENPOLY[0])]);
+ } else {
+ array_push($parity, 0);
+ }
+ }
+ }
+ }
+
+ //##########################################################################
+
+ class QRrs {
+
+ public static $items = array();
+
+ //----------------------------------------------------------------------
+ public static function init_rs($symsize, $gfpoly, $fcr, $prim, $nroots, $pad)
+ {
+ foreach(self::$items as $rs) {
+ if($rs->pad != $pad) continue;
+ if($rs->nroots != $nroots) continue;
+ if($rs->mm != $symsize) continue;
+ if($rs->gfpoly != $gfpoly) continue;
+ if($rs->fcr != $fcr) continue;
+ if($rs->prim != $prim) continue;
+
+ return $rs;
+ }
+
+ $rs = QRrsItem::init_rs_char($symsize, $gfpoly, $fcr, $prim, $nroots, $pad);
+ array_unshift(self::$items, $rs);
+
+ return $rs;
+ }
+ }
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrspec.php b/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrspec.php
new file mode 100644
index 000000000..5a0c4b3c1
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrspec.php
@@ -0,0 +1,592 @@
+
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia
+ *
+ * The following data / specifications are taken from
+ * "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004)
+ * or
+ * "Automatic identification and data capture techniques --
+ * QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+ define('QRSPEC_VERSION_MAX', 40);
+ define('QRSPEC_WIDTH_MAX', 177);
+
+ define('QRCAP_WIDTH', 0);
+ define('QRCAP_WORDS', 1);
+ define('QRCAP_REMINDER', 2);
+ define('QRCAP_EC', 3);
+
+ class QRspec {
+
+ public static $capacity = array(
+ array( 0, 0, 0, array( 0, 0, 0, 0)),
+ array( 21, 26, 0, array( 7, 10, 13, 17)), // 1
+ array( 25, 44, 7, array( 10, 16, 22, 28)),
+ array( 29, 70, 7, array( 15, 26, 36, 44)),
+ array( 33, 100, 7, array( 20, 36, 52, 64)),
+ array( 37, 134, 7, array( 26, 48, 72, 88)), // 5
+ array( 41, 172, 7, array( 36, 64, 96, 112)),
+ array( 45, 196, 0, array( 40, 72, 108, 130)),
+ array( 49, 242, 0, array( 48, 88, 132, 156)),
+ array( 53, 292, 0, array( 60, 110, 160, 192)),
+ array( 57, 346, 0, array( 72, 130, 192, 224)), //10
+ array( 61, 404, 0, array( 80, 150, 224, 264)),
+ array( 65, 466, 0, array( 96, 176, 260, 308)),
+ array( 69, 532, 0, array( 104, 198, 288, 352)),
+ array( 73, 581, 3, array( 120, 216, 320, 384)),
+ array( 77, 655, 3, array( 132, 240, 360, 432)), //15
+ array( 81, 733, 3, array( 144, 280, 408, 480)),
+ array( 85, 815, 3, array( 168, 308, 448, 532)),
+ array( 89, 901, 3, array( 180, 338, 504, 588)),
+ array( 93, 991, 3, array( 196, 364, 546, 650)),
+ array( 97, 1085, 3, array( 224, 416, 600, 700)), //20
+ array(101, 1156, 4, array( 224, 442, 644, 750)),
+ array(105, 1258, 4, array( 252, 476, 690, 816)),
+ array(109, 1364, 4, array( 270, 504, 750, 900)),
+ array(113, 1474, 4, array( 300, 560, 810, 960)),
+ array(117, 1588, 4, array( 312, 588, 870, 1050)), //25
+ array(121, 1706, 4, array( 336, 644, 952, 1110)),
+ array(125, 1828, 4, array( 360, 700, 1020, 1200)),
+ array(129, 1921, 3, array( 390, 728, 1050, 1260)),
+ array(133, 2051, 3, array( 420, 784, 1140, 1350)),
+ array(137, 2185, 3, array( 450, 812, 1200, 1440)), //30
+ array(141, 2323, 3, array( 480, 868, 1290, 1530)),
+ array(145, 2465, 3, array( 510, 924, 1350, 1620)),
+ array(149, 2611, 3, array( 540, 980, 1440, 1710)),
+ array(153, 2761, 3, array( 570, 1036, 1530, 1800)),
+ array(157, 2876, 0, array( 570, 1064, 1590, 1890)), //35
+ array(161, 3034, 0, array( 600, 1120, 1680, 1980)),
+ array(165, 3196, 0, array( 630, 1204, 1770, 2100)),
+ array(169, 3362, 0, array( 660, 1260, 1860, 2220)),
+ array(173, 3532, 0, array( 720, 1316, 1950, 2310)),
+ array(177, 3706, 0, array( 750, 1372, 2040, 2430)) //40
+ );
+
+ //----------------------------------------------------------------------
+ public static function getDataLength($version, $level)
+ {
+ return self::$capacity[$version][QRCAP_WORDS] - self::$capacity[$version][QRCAP_EC][$level];
+ }
+
+ //----------------------------------------------------------------------
+ public static function getECCLength($version, $level)
+ {
+ return self::$capacity[$version][QRCAP_EC][$level];
+ }
+
+ //----------------------------------------------------------------------
+ public static function getWidth($version)
+ {
+ return self::$capacity[$version][QRCAP_WIDTH];
+ }
+
+ //----------------------------------------------------------------------
+ public static function getRemainder($version)
+ {
+ return self::$capacity[$version][QRCAP_REMINDER];
+ }
+
+ //----------------------------------------------------------------------
+ public static function getMinimumVersion($size, $level)
+ {
+
+ for($i=1; $i<= QRSPEC_VERSION_MAX; $i++) {
+ $words = self::$capacity[$i][QRCAP_WORDS] - self::$capacity[$i][QRCAP_EC][$level];
+ if($words >= $size)
+ return $i;
+ }
+
+ return -1;
+ }
+
+ //######################################################################
+
+ public static $lengthTableBits = array(
+ array(10, 12, 14),
+ array( 9, 11, 13),
+ array( 8, 16, 16),
+ array( 8, 10, 12)
+ );
+
+ //----------------------------------------------------------------------
+ public static function lengthIndicator($mode, $version)
+ {
+ if ($mode == QR_MODE_STRUCTURE)
+ return 0;
+
+ if ($version <= 9) {
+ $l = 0;
+ } else if ($version <= 26) {
+ $l = 1;
+ } else {
+ $l = 2;
+ }
+
+ return self::$lengthTableBits[$mode][$l];
+ }
+
+ //----------------------------------------------------------------------
+ public static function maximumWords($mode, $version)
+ {
+ if($mode == QR_MODE_STRUCTURE)
+ return 3;
+
+ if($version <= 9) {
+ $l = 0;
+ } else if($version <= 26) {
+ $l = 1;
+ } else {
+ $l = 2;
+ }
+
+ $bits = self::$lengthTableBits[$mode][$l];
+ $words = (1 << $bits) - 1;
+
+ if($mode == QR_MODE_KANJI) {
+ $words *= 2; // the number of bytes is required
+ }
+
+ return $words;
+ }
+
+ // Error correction code -----------------------------------------------
+ // Table of the error correction code (Reed-Solomon block)
+ // See Table 12-16 (pp.30-36), JIS X0510:2004.
+
+ public static $eccTable = array(
+ array(array( 0, 0), array( 0, 0), array( 0, 0), array( 0, 0)),
+ array(array( 1, 0), array( 1, 0), array( 1, 0), array( 1, 0)), // 1
+ array(array( 1, 0), array( 1, 0), array( 1, 0), array( 1, 0)),
+ array(array( 1, 0), array( 1, 0), array( 2, 0), array( 2, 0)),
+ array(array( 1, 0), array( 2, 0), array( 2, 0), array( 4, 0)),
+ array(array( 1, 0), array( 2, 0), array( 2, 2), array( 2, 2)), // 5
+ array(array( 2, 0), array( 4, 0), array( 4, 0), array( 4, 0)),
+ array(array( 2, 0), array( 4, 0), array( 2, 4), array( 4, 1)),
+ array(array( 2, 0), array( 2, 2), array( 4, 2), array( 4, 2)),
+ array(array( 2, 0), array( 3, 2), array( 4, 4), array( 4, 4)),
+ array(array( 2, 2), array( 4, 1), array( 6, 2), array( 6, 2)), //10
+ array(array( 4, 0), array( 1, 4), array( 4, 4), array( 3, 8)),
+ array(array( 2, 2), array( 6, 2), array( 4, 6), array( 7, 4)),
+ array(array( 4, 0), array( 8, 1), array( 8, 4), array(12, 4)),
+ array(array( 3, 1), array( 4, 5), array(11, 5), array(11, 5)),
+ array(array( 5, 1), array( 5, 5), array( 5, 7), array(11, 7)), //15
+ array(array( 5, 1), array( 7, 3), array(15, 2), array( 3, 13)),
+ array(array( 1, 5), array(10, 1), array( 1, 15), array( 2, 17)),
+ array(array( 5, 1), array( 9, 4), array(17, 1), array( 2, 19)),
+ array(array( 3, 4), array( 3, 11), array(17, 4), array( 9, 16)),
+ array(array( 3, 5), array( 3, 13), array(15, 5), array(15, 10)), //20
+ array(array( 4, 4), array(17, 0), array(17, 6), array(19, 6)),
+ array(array( 2, 7), array(17, 0), array( 7, 16), array(34, 0)),
+ array(array( 4, 5), array( 4, 14), array(11, 14), array(16, 14)),
+ array(array( 6, 4), array( 6, 14), array(11, 16), array(30, 2)),
+ array(array( 8, 4), array( 8, 13), array( 7, 22), array(22, 13)), //25
+ array(array(10, 2), array(19, 4), array(28, 6), array(33, 4)),
+ array(array( 8, 4), array(22, 3), array( 8, 26), array(12, 28)),
+ array(array( 3, 10), array( 3, 23), array( 4, 31), array(11, 31)),
+ array(array( 7, 7), array(21, 7), array( 1, 37), array(19, 26)),
+ array(array( 5, 10), array(19, 10), array(15, 25), array(23, 25)), //30
+ array(array(13, 3), array( 2, 29), array(42, 1), array(23, 28)),
+ array(array(17, 0), array(10, 23), array(10, 35), array(19, 35)),
+ array(array(17, 1), array(14, 21), array(29, 19), array(11, 46)),
+ array(array(13, 6), array(14, 23), array(44, 7), array(59, 1)),
+ array(array(12, 7), array(12, 26), array(39, 14), array(22, 41)), //35
+ array(array( 6, 14), array( 6, 34), array(46, 10), array( 2, 64)),
+ array(array(17, 4), array(29, 14), array(49, 10), array(24, 46)),
+ array(array( 4, 18), array(13, 32), array(48, 14), array(42, 32)),
+ array(array(20, 4), array(40, 7), array(43, 22), array(10, 67)),
+ array(array(19, 6), array(18, 31), array(34, 34), array(20, 61)),//40
+ );
+
+ //----------------------------------------------------------------------
+ // CACHEABLE!!!
+
+ public static function getEccSpec($version, $level, array &$spec)
+ {
+ if (count($spec) < 5) {
+ $spec = array(0,0,0,0,0);
+ }
+
+ $b1 = self::$eccTable[$version][$level][0];
+ $b2 = self::$eccTable[$version][$level][1];
+ $data = self::getDataLength($version, $level);
+ $ecc = self::getECCLength($version, $level);
+
+ if($b2 == 0) {
+ $spec[0] = $b1;
+ $spec[1] = (int)($data / $b1);
+ $spec[2] = (int)($ecc / $b1);
+ $spec[3] = 0;
+ $spec[4] = 0;
+ } else {
+ $spec[0] = $b1;
+ $spec[1] = (int)($data / ($b1 + $b2));
+ $spec[2] = (int)($ecc / ($b1 + $b2));
+ $spec[3] = $b2;
+ $spec[4] = $spec[1] + 1;
+ }
+ }
+
+ // Alignment pattern ---------------------------------------------------
+
+ // Positions of alignment patterns.
+ // This array includes only the second and the third position of the
+ // alignment patterns. Rest of them can be calculated from the distance
+ // between them.
+
+ // See Table 1 in Appendix E (pp.71) of JIS X0510:2004.
+
+ public static $alignmentPattern = array(
+ array( 0, 0),
+ array( 0, 0), array(18, 0), array(22, 0), array(26, 0), array(30, 0), // 1- 5
+ array(34, 0), array(22, 38), array(24, 42), array(26, 46), array(28, 50), // 6-10
+ array(30, 54), array(32, 58), array(34, 62), array(26, 46), array(26, 48), //11-15
+ array(26, 50), array(30, 54), array(30, 56), array(30, 58), array(34, 62), //16-20
+ array(28, 50), array(26, 50), array(30, 54), array(28, 54), array(32, 58), //21-25
+ array(30, 58), array(34, 62), array(26, 50), array(30, 54), array(26, 52), //26-30
+ array(30, 56), array(34, 60), array(30, 58), array(34, 62), array(30, 54), //31-35
+ array(24, 50), array(28, 54), array(32, 58), array(26, 54), array(30, 58), //35-40
+ );
+
+
+ /** --------------------------------------------------------------------
+ * Put an alignment marker.
+ * @param frame
+ * @param width
+ * @param ox,oy center coordinate of the pattern
+ */
+ public static function putAlignmentMarker(array &$frame, $ox, $oy)
+ {
+ $finder = array(
+ "\xa1\xa1\xa1\xa1\xa1",
+ "\xa1\xa0\xa0\xa0\xa1",
+ "\xa1\xa0\xa1\xa0\xa1",
+ "\xa1\xa0\xa0\xa0\xa1",
+ "\xa1\xa1\xa1\xa1\xa1"
+ );
+
+ $yStart = $oy-2;
+ $xStart = $ox-2;
+
+ for($y=0; $y<5; $y++) {
+ QRstr::set($frame, $xStart, $yStart+$y, $finder[$y]);
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public static function putAlignmentPattern($version, &$frame, $width)
+ {
+ if($version < 2)
+ return;
+
+ $d = self::$alignmentPattern[$version][1] - self::$alignmentPattern[$version][0];
+ if($d < 0) {
+ $w = 2;
+ } else {
+ $w = (int)(($width - self::$alignmentPattern[$version][0]) / $d + 2);
+ }
+
+ if($w * $w - 3 == 1) {
+ $x = self::$alignmentPattern[$version][0];
+ $y = self::$alignmentPattern[$version][0];
+ self::putAlignmentMarker($frame, $x, $y);
+ return;
+ }
+
+ $cx = self::$alignmentPattern[$version][0];
+ for($x=1; $x<$w - 1; $x++) {
+ self::putAlignmentMarker($frame, 6, $cx);
+ self::putAlignmentMarker($frame, $cx, 6);
+ $cx += $d;
+ }
+
+ $cy = self::$alignmentPattern[$version][0];
+ for($y=0; $y<$w-1; $y++) {
+ $cx = self::$alignmentPattern[$version][0];
+ for($x=0; $x<$w-1; $x++) {
+ self::putAlignmentMarker($frame, $cx, $cy);
+ $cx += $d;
+ }
+ $cy += $d;
+ }
+ }
+
+ // Version information pattern -----------------------------------------
+
+ // Version information pattern (BCH coded).
+ // See Table 1 in Appendix D (pp.68) of JIS X0510:2004.
+
+ // size: [QRSPEC_VERSION_MAX - 6]
+
+ public static $versionPattern = array(
+ 0x07c94, 0x085bc, 0x09a99, 0x0a4d3, 0x0bbf6, 0x0c762, 0x0d847, 0x0e60d,
+ 0x0f928, 0x10b78, 0x1145d, 0x12a17, 0x13532, 0x149a6, 0x15683, 0x168c9,
+ 0x177ec, 0x18ec4, 0x191e1, 0x1afab, 0x1b08e, 0x1cc1a, 0x1d33f, 0x1ed75,
+ 0x1f250, 0x209d5, 0x216f0, 0x228ba, 0x2379f, 0x24b0b, 0x2542e, 0x26a64,
+ 0x27541, 0x28c69
+ );
+
+ //----------------------------------------------------------------------
+ public static function getVersionPattern($version)
+ {
+ if($version < 7 || $version > QRSPEC_VERSION_MAX)
+ return 0;
+
+ return self::$versionPattern[$version -7];
+ }
+
+ // Format information --------------------------------------------------
+ // See calcFormatInfo in tests/test_qrspec.c (orginal qrencode c lib)
+
+ public static $formatInfo = array(
+ array(0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976),
+ array(0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0),
+ array(0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed),
+ array(0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b)
+ );
+
+ public static function getFormatInfo($mask, $level)
+ {
+ if($mask < 0 || $mask > 7)
+ return 0;
+
+ if($level < 0 || $level > 3)
+ return 0;
+
+ return self::$formatInfo[$level][$mask];
+ }
+
+ // Frame ---------------------------------------------------------------
+ // Cache of initial frames.
+
+ public static $frames = array();
+
+ /** --------------------------------------------------------------------
+ * Put a finder pattern.
+ * @param frame
+ * @param width
+ * @param ox,oy upper-left coordinate of the pattern
+ */
+ public static function putFinderPattern(&$frame, $ox, $oy)
+ {
+ $finder = array(
+ "\xc1\xc1\xc1\xc1\xc1\xc1\xc1",
+ "\xc1\xc0\xc0\xc0\xc0\xc0\xc1",
+ "\xc1\xc0\xc1\xc1\xc1\xc0\xc1",
+ "\xc1\xc0\xc1\xc1\xc1\xc0\xc1",
+ "\xc1\xc0\xc1\xc1\xc1\xc0\xc1",
+ "\xc1\xc0\xc0\xc0\xc0\xc0\xc1",
+ "\xc1\xc1\xc1\xc1\xc1\xc1\xc1"
+ );
+
+ for($y=0; $y<7; $y++) {
+ QRstr::set($frame, $ox, $oy+$y, $finder[$y]);
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public static function createFrame($version)
+ {
+ $width = self::$capacity[$version][QRCAP_WIDTH];
+ $frameLine = str_repeat ("\0", $width);
+ $frame = array_fill(0, $width, $frameLine);
+
+ // Finder pattern
+ self::putFinderPattern($frame, 0, 0);
+ self::putFinderPattern($frame, $width - 7, 0);
+ self::putFinderPattern($frame, 0, $width - 7);
+
+ // Separator
+ $yOffset = $width - 7;
+
+ for($y=0; $y<7; $y++) {
+ $frame[$y][7] = "\xc0";
+ $frame[$y][$width - 8] = "\xc0";
+ $frame[$yOffset][7] = "\xc0";
+ $yOffset++;
+ }
+
+ $setPattern = str_repeat("\xc0", 8);
+
+ QRstr::set($frame, 0, 7, $setPattern);
+ QRstr::set($frame, $width-8, 7, $setPattern);
+ QRstr::set($frame, 0, $width - 8, $setPattern);
+
+ // Format info
+ $setPattern = str_repeat("\x84", 9);
+ QRstr::set($frame, 0, 8, $setPattern);
+ QRstr::set($frame, $width - 8, 8, $setPattern, 8);
+
+ $yOffset = $width - 8;
+
+ for($y=0; $y<8; $y++,$yOffset++) {
+ $frame[$y][8] = "\x84";
+ $frame[$yOffset][8] = "\x84";
+ }
+
+ // Timing pattern
+
+ for($i=1; $i<$width-15; $i++) {
+ $frame[6][7+$i] = chr(0x90 | ($i & 1));
+ $frame[7+$i][6] = chr(0x90 | ($i & 1));
+ }
+
+ // Alignment pattern
+ self::putAlignmentPattern($version, $frame, $width);
+
+ // Version information
+ if($version >= 7) {
+ $vinf = self::getVersionPattern($version);
+
+ $v = $vinf;
+
+ for($x=0; $x<6; $x++) {
+ for($y=0; $y<3; $y++) {
+ $frame[($width - 11)+$y][$x] = chr(0x88 | ($v & 1));
+ $v = $v >> 1;
+ }
+ }
+
+ $v = $vinf;
+ for($y=0; $y<6; $y++) {
+ for($x=0; $x<3; $x++) {
+ $frame[$y][$x+($width - 11)] = chr(0x88 | ($v & 1));
+ $v = $v >> 1;
+ }
+ }
+ }
+
+ // and a little bit...
+ $frame[$width - 8][8] = "\x81";
+
+ return $frame;
+ }
+
+ //----------------------------------------------------------------------
+ public static function debug($frame, $binary_mode = false)
+ {
+ if ($binary_mode) {
+
+ foreach ($frame as &$frameLine) {
+ $frameLine = join(' ', explode('0', $frameLine));
+ $frameLine = join('██', explode('1', $frameLine));
+ }
+
+ ?>
+
+
';
+ echo join("
", $frame);
+ echo '
';
+
+ } else {
+
+ foreach ($frame as &$frameLine) {
+ $frameLine = join(' ', explode("\xc0", $frameLine));
+ $frameLine = join('▒', explode("\xc1", $frameLine));
+ $frameLine = join(' ', explode("\xa0", $frameLine));
+ $frameLine = join('▒', explode("\xa1", $frameLine));
+ $frameLine = join('◇', explode("\x84", $frameLine)); //format 0
+ $frameLine = join('◆', explode("\x85", $frameLine)); //format 1
+ $frameLine = join('☢', explode("\x81", $frameLine)); //special bit
+ $frameLine = join(' ', explode("\x90", $frameLine)); //clock 0
+ $frameLine = join('◷', explode("\x91", $frameLine)); //clock 1
+ $frameLine = join(' ', explode("\x88", $frameLine)); //version
+ $frameLine = join('▒', explode("\x89", $frameLine)); //version
+ $frameLine = join('♦', explode("\x01", $frameLine));
+ $frameLine = join('⋅', explode("\0", $frameLine));
+ }
+
+ ?>
+
+ ";
+ echo join("
", $frame);
+ echo "";
+
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public static function serial($frame)
+ {
+ return gzcompress(join("\n", $frame), 9);
+ }
+
+ //----------------------------------------------------------------------
+ public static function unserial($code)
+ {
+ return explode("\n", gzuncompress($code));
+ }
+
+ //----------------------------------------------------------------------
+ public static function newFrame($version)
+ {
+ if($version < 1 || $version > QRSPEC_VERSION_MAX)
+ return null;
+
+ if(!isset(self::$frames[$version])) {
+
+ $fileName = QR_CACHE_DIR.'frame_'.$version.'.dat';
+
+ if (QR_CACHEABLE) {
+ if (file_exists($fileName)) {
+ self::$frames[$version] = self::unserial(file_get_contents($fileName));
+ } else {
+ self::$frames[$version] = self::createFrame($version);
+ file_put_contents($fileName, self::serial(self::$frames[$version]));
+ }
+ } else {
+ self::$frames[$version] = self::createFrame($version);
+ }
+ }
+
+ if(is_null(self::$frames[$version]))
+ return null;
+
+ return self::$frames[$version];
+ }
+
+ //----------------------------------------------------------------------
+ public static function rsBlockNum($spec) { return $spec[0] + $spec[3]; }
+ public static function rsBlockNum1($spec) { return $spec[0]; }
+ public static function rsDataCodes1($spec) { return $spec[1]; }
+ public static function rsEccCodes1($spec) { return $spec[2]; }
+ public static function rsBlockNum2($spec) { return $spec[3]; }
+ public static function rsDataCodes2($spec) { return $spec[4]; }
+ public static function rsEccCodes2($spec) { return $spec[2]; }
+ public static function rsDataLength($spec) { return ($spec[0] * $spec[1]) + ($spec[3] * $spec[4]); }
+ public static function rsEccLength($spec) { return ($spec[0] + $spec[3]) * $spec[2]; }
+
+ }
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrsplit.php b/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrsplit.php
new file mode 100644
index 000000000..6399f53e4
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrsplit.php
@@ -0,0 +1,311 @@
+
+ *
+ * PHP QR Code is distributed under LGPL 3
+ * Copyright (C) 2010 Dominik Dzienia
+ *
+ * The following data / specifications are taken from
+ * "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004)
+ * or
+ * "Automatic identification and data capture techniques --
+ * QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+ class QRsplit {
+
+ public $dataStr = '';
+ public $input;
+ public $modeHint;
+
+ //----------------------------------------------------------------------
+ public function __construct($dataStr, $input, $modeHint)
+ {
+ $this->dataStr = $dataStr;
+ $this->input = $input;
+ $this->modeHint = $modeHint;
+ }
+
+ //----------------------------------------------------------------------
+ public static function isdigitat($str, $pos)
+ {
+ if ($pos >= strlen($str))
+ return false;
+
+ return ((ord($str[$pos]) >= ord('0'))&&(ord($str[$pos]) <= ord('9')));
+ }
+
+ //----------------------------------------------------------------------
+ public static function isalnumat($str, $pos)
+ {
+ if ($pos >= strlen($str))
+ return false;
+
+ return (QRinput::lookAnTable(ord($str[$pos])) >= 0);
+ }
+
+ //----------------------------------------------------------------------
+ public function identifyMode($pos)
+ {
+ if ($pos >= strlen($this->dataStr))
+ return QR_MODE_NUL;
+
+ $c = $this->dataStr[$pos];
+
+ if(self::isdigitat($this->dataStr, $pos)) {
+ return QR_MODE_NUM;
+ } else if(self::isalnumat($this->dataStr, $pos)) {
+ return QR_MODE_AN;
+ } else if($this->modeHint == QR_MODE_KANJI) {
+
+ if ($pos+1 < strlen($this->dataStr))
+ {
+ $d = $this->dataStr[$pos+1];
+ $word = (ord($c) << 8) | ord($d);
+ if(($word >= 0x8140 && $word <= 0x9ffc) || ($word >= 0xe040 && $word <= 0xebbf)) {
+ return QR_MODE_KANJI;
+ }
+ }
+ }
+
+ return QR_MODE_8;
+ }
+
+ //----------------------------------------------------------------------
+ public function eatNum()
+ {
+ $ln = QRspec::lengthIndicator(QR_MODE_NUM, $this->input->getVersion());
+
+ $p = 0;
+ while(self::isdigitat($this->dataStr, $p)) {
+ $p++;
+ }
+
+ $run = $p;
+ $mode = $this->identifyMode($p);
+
+ if($mode == QR_MODE_8) {
+ $dif = QRinput::estimateBitsModeNum($run) + 4 + $ln
+ + QRinput::estimateBitsMode8(1) // + 4 + l8
+ - QRinput::estimateBitsMode8($run + 1); // - 4 - l8
+ if($dif > 0) {
+ return $this->eat8();
+ }
+ }
+ if($mode == QR_MODE_AN) {
+ $dif = QRinput::estimateBitsModeNum($run) + 4 + $ln
+ + QRinput::estimateBitsModeAn(1) // + 4 + la
+ - QRinput::estimateBitsModeAn($run + 1);// - 4 - la
+ if($dif > 0) {
+ return $this->eatAn();
+ }
+ }
+
+ $ret = $this->input->append(QR_MODE_NUM, $run, str_split($this->dataStr));
+ if($ret < 0)
+ return -1;
+
+ return $run;
+ }
+
+ //----------------------------------------------------------------------
+ public function eatAn()
+ {
+ $la = QRspec::lengthIndicator(QR_MODE_AN, $this->input->getVersion());
+ $ln = QRspec::lengthIndicator(QR_MODE_NUM, $this->input->getVersion());
+
+ $p = 0;
+
+ while(self::isalnumat($this->dataStr, $p)) {
+ if(self::isdigitat($this->dataStr, $p)) {
+ $q = $p;
+ while(self::isdigitat($this->dataStr, $q)) {
+ $q++;
+ }
+
+ $dif = QRinput::estimateBitsModeAn($p) // + 4 + la
+ + QRinput::estimateBitsModeNum($q - $p) + 4 + $ln
+ - QRinput::estimateBitsModeAn($q); // - 4 - la
+
+ if($dif < 0) {
+ break;
+ } else {
+ $p = $q;
+ }
+ } else {
+ $p++;
+ }
+ }
+
+ $run = $p;
+
+ if(!self::isalnumat($this->dataStr, $p)) {
+ $dif = QRinput::estimateBitsModeAn($run) + 4 + $la
+ + QRinput::estimateBitsMode8(1) // + 4 + l8
+ - QRinput::estimateBitsMode8($run + 1); // - 4 - l8
+ if($dif > 0) {
+ return $this->eat8();
+ }
+ }
+
+ $ret = $this->input->append(QR_MODE_AN, $run, str_split($this->dataStr));
+ if($ret < 0)
+ return -1;
+
+ return $run;
+ }
+
+ //----------------------------------------------------------------------
+ public function eatKanji()
+ {
+ $p = 0;
+
+ while($this->identifyMode($p) == QR_MODE_KANJI) {
+ $p += 2;
+ }
+
+ $ret = $this->input->append(QR_MODE_KANJI, $p, str_split($this->dataStr));
+ if($ret < 0)
+ return -1;
+
+ return $run;
+ }
+
+ //----------------------------------------------------------------------
+ public function eat8()
+ {
+ $la = QRspec::lengthIndicator(QR_MODE_AN, $this->input->getVersion());
+ $ln = QRspec::lengthIndicator(QR_MODE_NUM, $this->input->getVersion());
+
+ $p = 1;
+ $dataStrLen = strlen($this->dataStr);
+
+ while($p < $dataStrLen) {
+
+ $mode = $this->identifyMode($p);
+ if($mode == QR_MODE_KANJI) {
+ break;
+ }
+ if($mode == QR_MODE_NUM) {
+ $q = $p;
+ while(self::isdigitat($this->dataStr, $q)) {
+ $q++;
+ }
+ $dif = QRinput::estimateBitsMode8($p) // + 4 + l8
+ + QRinput::estimateBitsModeNum($q - $p) + 4 + $ln
+ - QRinput::estimateBitsMode8($q); // - 4 - l8
+ if($dif < 0) {
+ break;
+ } else {
+ $p = $q;
+ }
+ } else if($mode == QR_MODE_AN) {
+ $q = $p;
+ while(self::isalnumat($this->dataStr, $q)) {
+ $q++;
+ }
+ $dif = QRinput::estimateBitsMode8($p) // + 4 + l8
+ + QRinput::estimateBitsModeAn($q - $p) + 4 + $la
+ - QRinput::estimateBitsMode8($q); // - 4 - l8
+ if($dif < 0) {
+ break;
+ } else {
+ $p = $q;
+ }
+ } else {
+ $p++;
+ }
+ }
+
+ $run = $p;
+ $ret = $this->input->append(QR_MODE_8, $run, str_split($this->dataStr));
+
+ if($ret < 0)
+ return -1;
+
+ return $run;
+ }
+
+ //----------------------------------------------------------------------
+ public function splitString()
+ {
+ while (strlen($this->dataStr) > 0)
+ {
+ if($this->dataStr == '')
+ return 0;
+
+ $mode = $this->identifyMode(0);
+
+ switch ($mode) {
+ case QR_MODE_NUM: $length = $this->eatNum(); break;
+ case QR_MODE_AN: $length = $this->eatAn(); break;
+ case QR_MODE_KANJI:
+ if ($hint == QR_MODE_KANJI)
+ $length = $this->eatKanji();
+ else $length = $this->eat8();
+ break;
+ default: $length = $this->eat8(); break;
+
+ }
+
+ if($length == 0) return 0;
+ if($length < 0) return -1;
+
+ $this->dataStr = substr($this->dataStr, $length);
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public function toUpper()
+ {
+ $stringLen = strlen($this->dataStr);
+ $p = 0;
+
+ while ($p<$stringLen) {
+ $mode = self::identifyMode(substr($this->dataStr, $p), $this->modeHint);
+ if($mode == QR_MODE_KANJI) {
+ $p += 2;
+ } else {
+ if (ord($this->dataStr[$p]) >= ord('a') && ord($this->dataStr[$p]) <= ord('z')) {
+ $this->dataStr[$p] = chr(ord($this->dataStr[$p]) - 32);
+ }
+ $p++;
+ }
+ }
+
+ return $this->dataStr;
+ }
+
+ //----------------------------------------------------------------------
+ public static function splitStringToQRinput($string, QRinput $input, $modeHint, $casesensitive = true)
+ {
+ if(is_null($string) || $string == '\0' || $string == '') {
+ throw new Exception('empty string!!!');
+ }
+
+ $split = new QRsplit($string, $input, $modeHint);
+
+ if(!$casesensitive)
+ $split->toUpper();
+
+ return $split->splitString();
+ }
+ }
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrtools.php b/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrtools.php
new file mode 100644
index 000000000..e0412c430
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/qrtools.php
@@ -0,0 +1,172 @@
+
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+ class QRtools {
+
+ //----------------------------------------------------------------------
+ public static function binarize($frame)
+ {
+ $len = count($frame);
+ foreach ($frame as &$frameLine) {
+
+ for($i=0; $i<$len; $i++) {
+ $frameLine[$i] = (ord($frameLine[$i])&1)?'1':'0';
+ }
+ }
+
+ return $frame;
+ }
+
+ //----------------------------------------------------------------------
+ public static function tcpdfBarcodeArray($code, $mode = 'QR,L', $tcPdfVersion = '4.5.037')
+ {
+ $barcode_array = array();
+
+ if (!is_array($mode))
+ $mode = explode(',', $mode);
+
+ $eccLevel = 'L';
+
+ if (count($mode) > 1) {
+ $eccLevel = $mode[1];
+ }
+
+ $qrTab = QRcode::text($code, false, $eccLevel);
+ $size = count($qrTab);
+
+ $barcode_array['num_rows'] = $size;
+ $barcode_array['num_cols'] = $size;
+ $barcode_array['bcode'] = array();
+
+ foreach ($qrTab as $line) {
+ $arrAdd = array();
+ foreach(str_split($line) as $char)
+ $arrAdd[] = ($char=='1')?1:0;
+ $barcode_array['bcode'][] = $arrAdd;
+ }
+
+ return $barcode_array;
+ }
+
+ //----------------------------------------------------------------------
+ public static function clearCache()
+ {
+ self::$frames = array();
+ }
+
+ //----------------------------------------------------------------------
+ public static function buildCache()
+ {
+ QRtools::markTime('before_build_cache');
+
+ $mask = new QRmask();
+ for ($a=1; $a <= QRSPEC_VERSION_MAX; $a++) {
+ $frame = QRspec::newFrame($a);
+ if (QR_IMAGE) {
+ $fileName = QR_CACHE_DIR.'frame_'.$a.'.png';
+ QRimage::png(self::binarize($frame), $fileName, 1, 0);
+ }
+
+ $width = count($frame);
+ $bitMask = array_fill(0, $width, array_fill(0, $width, 0));
+ for ($maskNo=0; $maskNo<8; $maskNo++)
+ $mask->makeMaskNo($maskNo, $width, $frame, $bitMask, true);
+ }
+
+ QRtools::markTime('after_build_cache');
+ }
+
+ //----------------------------------------------------------------------
+ public static function log($outfile, $err)
+ {
+ if (QR_LOG_DIR !== false) {
+ if ($err != '') {
+ if ($outfile !== false) {
+ file_put_contents(QR_LOG_DIR.basename($outfile).'-errors.txt', date('Y-m-d H:i:s').': '.$err, FILE_APPEND);
+ } else {
+ file_put_contents(QR_LOG_DIR.'errors.txt', date('Y-m-d H:i:s').': '.$err, FILE_APPEND);
+ }
+ }
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public static function dumpMask($frame)
+ {
+ $width = count($frame);
+ for($y=0;$y<$width;$y++) {
+ for($x=0;$x<$width;$x++) {
+ echo ord($frame[$y][$x]).',';
+ }
+ }
+ }
+
+ //----------------------------------------------------------------------
+ public static function markTime($markerId)
+ {
+ list($usec, $sec) = explode(" ", microtime());
+ $time = ((float)$usec + (float)$sec);
+
+ if (!isset($GLOBALS['qr_time_bench']))
+ $GLOBALS['qr_time_bench'] = array();
+
+ $GLOBALS['qr_time_bench'][$markerId] = $time;
+ }
+
+ //----------------------------------------------------------------------
+ public static function timeBenchmark()
+ {
+ self::markTime('finish');
+
+ $lastTime = 0;
+ $startTime = 0;
+ $p = 0;
+
+ echo '
+ | BENCHMARK |
+ ';
+
+ foreach($GLOBALS['qr_time_bench'] as $markerId=>$thisTime) {
+ if ($p > 0) {
+ echo '| till '.$markerId.': | '.number_format($thisTime-$lastTime, 6).'s |
';
+ } else {
+ $startTime = $thisTime;
+ }
+
+ $p++;
+ $lastTime = $thisTime;
+ }
+
+ echo '
+ | TOTAL: | '.number_format($lastTime-$startTime, 6).'s |
+
+
';
+ }
+
+ }
+
+ //##########################################################################
+
+ QRtools::markTime('start');
+
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/tools/merge.bat b/niucloud/vendor/kkokk/poster/src/PHPQrcode/tools/merge.bat
new file mode 100644
index 000000000..2b5eebbea
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/tools/merge.bat
@@ -0,0 +1,2 @@
+php ./merge.php
+pause
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/tools/merge.php b/niucloud/vendor/kkokk/poster/src/PHPQrcode/tools/merge.php
new file mode 100644
index 000000000..9e809c8e3
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/tools/merge.php
@@ -0,0 +1,70 @@
+
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+ $QR_BASEDIR = dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR;
+ $QR_TOOLSDIR = dirname(__FILE__).DIRECTORY_SEPARATOR;
+
+ $outputFile = $QR_BASEDIR.'phpqrcode.php';
+
+ // Required libs
+
+ $fileList = array(
+ $QR_BASEDIR.'qrconst.php',
+ $QR_TOOLSDIR.'merged_config.php',
+ $QR_BASEDIR.'qrtools.php',
+ $QR_BASEDIR.'qrspec.php',
+ $QR_BASEDIR.'qrimage.php',
+ $QR_BASEDIR.'qrinput.php',
+ $QR_BASEDIR.'qrbitstream.php',
+ $QR_BASEDIR.'qrsplit.php',
+ $QR_BASEDIR.'qrrscode.php',
+ $QR_BASEDIR.'qrmask.php',
+ $QR_BASEDIR.'qrencode.php'
+ );
+
+ $headerFile = $QR_TOOLSDIR.'merged_header.php';
+ $versionFile = $QR_BASEDIR.'VERSION';
+
+ $outputCode = '';
+
+ foreach($fileList as $fileName) {
+ $outputCode .= "\n\n".'//---- '.basename($fileName).' -----------------------------'."\n\n";
+ $anotherCode = file_get_contents($fileName);
+ $anotherCode = preg_replace ('/^<\?php/', '', $anotherCode);
+ $anotherCode = preg_replace ('/\?>\*$/', '', $anotherCode);
+ $outputCode .= "\n\n".$anotherCode."\n\n";
+ }
+
+ $versionDataEx = explode("\n", file_get_contents($versionFile));
+
+ $outputContents = file_get_contents($headerFile);
+ $outputContents .= "\n\n/*\n * Version: ".trim($versionDataEx[0])."\n * Build: ".trim($versionDataEx[1])."\n */\n\n";
+ $outputContents .= $outputCode;
+
+ file_put_contents($outputFile, $outputContents);
+
+
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/tools/merge.sh b/niucloud/vendor/kkokk/poster/src/PHPQrcode/tools/merge.sh
new file mode 100644
index 000000000..1a2515ba8
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/tools/merge.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+php ./merge.php
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PHPQrcode/tools/merged_config.php b/niucloud/vendor/kkokk/poster/src/PHPQrcode/tools/merged_config.php
new file mode 100644
index 000000000..8cd917dbc
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PHPQrcode/tools/merged_config.php
@@ -0,0 +1,17 @@
+
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/PosterManager.php b/niucloud/vendor/kkokk/poster/src/PosterManager.php
new file mode 100644
index 000000000..2d6453e9f
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/PosterManager.php
@@ -0,0 +1,77 @@
+create($method, $params);
+ }
+
+ /**
+ * @param $method
+ * @param $params
+ * @return mixed
+ * @throws SystemException
+ */
+ public static function __callStatic($method, $params)
+ {
+ self::$options = $params;
+ self::$className = __NAMESPACE__ . '\\Lang\\' . $method; // 使用接口类实现 只是测试不同方式实现
+ return self::buildConnector();
+ }
+
+ /**
+ * @param string $method
+ * @param array $params
+ * @return mixed
+ * @throws SystemException
+ */
+ private function create($method, $params)
+ {
+ return call_user_func_array([self::buildConnector(), $method], $params);
+ }
+
+ private static function buildConnector()
+ {
+ if (!isset(self::$connector[self::$className])) {
+
+ if (!class_exists(self::$className)) {
+ throw new SystemException("the class name does not exist . class : " . self::$className);
+ }
+ if (empty(self::$options)) {
+ self::$connector[self::$className] = new self::$className(self::$options);
+ } else {
+ self::$connector[self::$className] = new self::$className(...self::$options);
+ }
+ }
+ return self::$connector[self::$className];
+ }
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/src/style/rotate_bg/rotate01.jpg b/niucloud/vendor/kkokk/poster/src/style/rotate_bg/rotate01.jpg
new file mode 100644
index 000000000..5f36ee1cd
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/style/rotate_bg/rotate01.jpg differ
diff --git a/niucloud/vendor/kkokk/poster/src/style/rotate_bg/rotate02.jpg b/niucloud/vendor/kkokk/poster/src/style/rotate_bg/rotate02.jpg
new file mode 100644
index 000000000..3fd96f611
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/style/rotate_bg/rotate02.jpg differ
diff --git a/niucloud/vendor/kkokk/poster/src/style/rotate_bg/rotate03.jpg b/niucloud/vendor/kkokk/poster/src/style/rotate_bg/rotate03.jpg
new file mode 100644
index 000000000..38556cc1d
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/style/rotate_bg/rotate03.jpg differ
diff --git a/niucloud/vendor/kkokk/poster/src/style/rotate_bg/rotate04.jpg b/niucloud/vendor/kkokk/poster/src/style/rotate_bg/rotate04.jpg
new file mode 100644
index 000000000..ee4c5afeb
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/style/rotate_bg/rotate04.jpg differ
diff --git a/niucloud/vendor/kkokk/poster/src/style/rotate_bg/rotate05.jpg b/niucloud/vendor/kkokk/poster/src/style/rotate_bg/rotate05.jpg
new file mode 100644
index 000000000..68e4c0035
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/style/rotate_bg/rotate05.jpg differ
diff --git a/niucloud/vendor/kkokk/poster/src/style/simkai.ttf b/niucloud/vendor/kkokk/poster/src/style/simkai.ttf
new file mode 100644
index 000000000..1aa018b6d
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/style/simkai.ttf differ
diff --git a/niucloud/vendor/kkokk/poster/src/style/slider_bg/layer01.jpg b/niucloud/vendor/kkokk/poster/src/style/slider_bg/layer01.jpg
new file mode 100644
index 000000000..9fae437cb
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/style/slider_bg/layer01.jpg differ
diff --git a/niucloud/vendor/kkokk/poster/src/style/slider_bg/layer02.jpg b/niucloud/vendor/kkokk/poster/src/style/slider_bg/layer02.jpg
new file mode 100644
index 000000000..7b8b13641
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/style/slider_bg/layer02.jpg differ
diff --git a/niucloud/vendor/kkokk/poster/src/style/slider_bg/layer03.jpg b/niucloud/vendor/kkokk/poster/src/style/slider_bg/layer03.jpg
new file mode 100644
index 000000000..8a735bb77
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/style/slider_bg/layer03.jpg differ
diff --git a/niucloud/vendor/kkokk/poster/src/style/zhankukuheiti.ttf b/niucloud/vendor/kkokk/poster/src/style/zhankukuheiti.ttf
new file mode 100644
index 000000000..8d2a1d7f3
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/src/style/zhankukuheiti.ttf differ
diff --git a/niucloud/vendor/kkokk/poster/src/tmp/.gitignore b/niucloud/vendor/kkokk/poster/src/tmp/.gitignore
new file mode 100644
index 000000000..d59519736
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/src/tmp/.gitignore
@@ -0,0 +1 @@
+html*
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/tests/1223015613610230151165.gif b/niucloud/vendor/kkokk/poster/tests/1223015613610230151165.gif
new file mode 100644
index 000000000..89f88c82c
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/tests/1223015613610230151165.gif differ
diff --git a/niucloud/vendor/kkokk/poster/tests/1223015613615230151165.gif b/niucloud/vendor/kkokk/poster/tests/1223015613615230151165.gif
new file mode 100644
index 000000000..7b7042b9c
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/tests/1223015613615230151165.gif differ
diff --git a/niucloud/vendor/kkokk/poster/tests/122301561368230151165-1.gif b/niucloud/vendor/kkokk/poster/tests/122301561368230151165-1.gif
new file mode 100644
index 000000000..d645e3469
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/tests/122301561368230151165-1.gif differ
diff --git a/niucloud/vendor/kkokk/poster/tests/JoJhekR1um.png b/niucloud/vendor/kkokk/poster/tests/JoJhekR1um.png
new file mode 100644
index 000000000..a2eb3e46d
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/tests/JoJhekR1um.png differ
diff --git a/niucloud/vendor/kkokk/poster/tests/Kvt1cV5ygB.png b/niucloud/vendor/kkokk/poster/tests/Kvt1cV5ygB.png
new file mode 100644
index 000000000..8d6b6b4e0
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/tests/Kvt1cV5ygB.png differ
diff --git a/niucloud/vendor/kkokk/poster/tests/YRG3X4WgSZ3lLlwULkxZ3W3LLGgZ4b.jpeg b/niucloud/vendor/kkokk/poster/tests/YRG3X4WgSZ3lLlwULkxZ3W3LLGgZ4b.jpeg
new file mode 100644
index 000000000..3988c3a54
Binary files /dev/null and b/niucloud/vendor/kkokk/poster/tests/YRG3X4WgSZ3lLlwULkxZ3W3LLGgZ4b.jpeg differ
diff --git a/niucloud/vendor/kkokk/poster/tests/htmlToImage.php b/niucloud/vendor/kkokk/poster/tests/htmlToImage.php
new file mode 100644
index 000000000..637b01508
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/tests/htmlToImage.php
@@ -0,0 +1,28 @@
+













';
+
+$chunkHeight = 1500;
+
+$poster = Poster::extension('imagick')->buildImDst(Html::load($html)->size(480)->render());
+$imInfo = $poster->getImInfo();
+$tmpIm = $poster->tmp();
+$width = $imInfo['width'];
+$height = $imInfo['height'];
+$count = ceil($height / $chunkHeight);
+for ($i = 0; $i < $count; $i ++) {
+ $y = $chunkHeight * $i;
+ if($i + 1 == $count) {
+ $chunkHeight = $height - $y;
+ }
+ $crop = Poster::buildImDst($tmpIm)->crop(0, $y,$width, $chunkHeight)->getPoster(__DIR__ . '/crop/' . $i . '.png');
+}
diff --git a/niucloud/vendor/kkokk/poster/tests/imagick.php b/niucloud/vendor/kkokk/poster/tests/imagick.php
new file mode 100644
index 000000000..4fb06fde8
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/tests/imagick.php
@@ -0,0 +1,24 @@
+config(['path'=>'poster/imagick.png','font_family'=> __DIR__ . '/../src/style/simkai.ttf'])
+ ->buildIm(638,826,[255,255,255,1],true)
+ ->getPoster();
+
+} catch (PosterException $e) {
+
+ print_r($e->getMessage());
+
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/tests/index.php b/niucloud/vendor/kkokk/poster/tests/index.php
new file mode 100644
index 000000000..65eb8c66d
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/tests/index.php
@@ -0,0 +1,301 @@
+Qr('http://www.baidu.com','poster/1.png', 'L', 4, 1, 1);
+ // var_dump($result);
+ // exit;
+ // var_dump(Poster::extension()->config(['path'=>'poster/avatar1.png','font_family'=> __DIR__ . '/../src/style/simkai.ttf'])
+ // ->buildIm(400,400,[255,255,255, 1],true)
+ // ->buildText('Poster', ['center', 22], 'center', 108, [52, 52, 52, 1], '', '', 20)
+ // ->getPoster()
+ // );
+ // exit;
+ // echo microtime().PHP_EOL;
+ // $json = '[{"x":186,"y":182},{"x":94,"y":157}]';
+ // $secret = '[{"contents":"\u7ea2","point":[157,169,185,215,215,197,187,151,-58]},{"contents":"\u70e7","point":[61,150,95,193,123,172,89,129,-51]}]';
+ // $data = PosterManager::Captcha()->type('click')->check(0, json_decode($json, true), 0, $secret);
+ // var_dump($data);
+ // exit;
+ // $data = PosterManager::Captcha()->get();
+ // $data = Captcha::type()->config(['slider_bg'=>-1])->get();
+ // $data = Captcha::type('input')->config(['contents'=>'红烧'])->get();
+ // // $data = PosterManager::Captcha()->type('input')->config(['src'=>__DIR__.'/../src/style/slider_bg/layer01.jpg'])->get();
+ // $data = PosterManager::Captcha()->type('click')->config(['contents'=>'红烧'])->get();
+ // $data = PosterManager::Captcha()->type('input')->config(['type'=>'number'])->get();
+ // $data = PosterManager::Captcha()->type('input')->config(['type'=>'alpha_num'])->get();
+ // $data = PosterManager::Captcha()->type('input')->config(['type'=>'text'])->get();
+ // $data = PosterManager::Captcha()->type('input')->config(['type'=>'math'])->get();
+ // $data = PosterManager::Captcha()->type('rotate')->get();
+
+ // print_r($data['img']);
+
+ // echo (memory_get_usage() / 1024 / 1024).'M'.PHP_EOL;
+ // echo microtime().PHP_EOL;
+ // echo (memory_get_peak_usage() / 1024 / 1024).'M'.PHP_EOL;
+ // print_r(getrusage()).PHP_EOL;
+ // exit;
+
+ # 静态调用
+ // 合成图片
+ // $result = PosterManager::Poster('poster/poster_user')
+ // ->buildIm(638,826,[255,255,255,127],false)
+ // ->buildImage('https://test.acyapi.51acy.com/wechat/poster/top_bg.png')
+ // ->buildImage('https://test.acyapi.51acy.com/wechat/poster/half_circle.png',254,321)
+ // ->buildImage('https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=2854425629,4097927492&fm=26&gp=0.jpg',253,326,0,0,131,131,false,'circle')
+ // ->buildImage('https://test.acyapi.51acy.com/wechat/poster/fengexian.png',0,655)
+ // ->buildImage('https://test.acyapi.51acy.com/wechat/qrcode/poster_241.jpg',37,692,0,0,122,122)
+ // ->buildText('苏轼','center',477,16,[51, 51, 51, 1])
+ // ->buildText('明月几时有,把酒问青天。不知天上宫阙,今夕是何年。','center',515,14,[153, 153, 153, 1])
+ // ->buildText('长按识别',497,720,15,[153, 153, 153, 1])
+ // ->buildText('查看TA的更多作品',413,757,15,[153, 153, 153, 1])
+ // ->buildQr('http://www.baidu.com','20%','20%',0,0,8,2)
+ // ->getPoster();
+
+
+ # 批量合成
+ $buildImageManyArr = [
+ [
+ 'src' => 'https://test.acyapi.51acy.com/wechat/poster/top_bg.png'
+ ],
+ [
+ 'src' => 'https://test.acyapi.51acy.com/wechat/poster/half_circle.png', 'dst_x' => 254, 'dst_y' => 321
+ ],
+ [
+ 'src' => 'https://portrait.gitee.com/uploads/avatars/user/721/2164500_langlanglang_1601019617.png', 'dst_x' => 253, 'dst_y' => 326, 'src_x' => 0, 'src_y' => 0, 'src_w' => 131, 'src_h' => 131, 'alpha' => false, 'type' => 'circle'
+ ],
+ [
+ 'src' => 'https://test.acyapi.51acy.com/wechat/poster/fengexian.png', 'dst_x' => 0, 'dst_y' => 655
+ ]
+ ];
+ $buildTextManyArr = [
+ [
+ 'content' => '苏轼', 'dst_x' => 'center', 'dst_y' => 477, 'font' => 16, 'rgba' => [51, 51, 51, 1], 'max_w' => 0, 'font_family' => '', 'weight' => 1, 'space' => 20
+ ],
+ [
+ 'content' => '明月几时有,把酒问青天。不知天上宫阙,今夕是何年。', 'dst_x' => 'center', 'dst_y' => 515, 'font' => 16, 'rgba' => [51, 51, 51, 1]
+ ],
+ [
+ 'content' => '我欲乘风归去,又恐琼楼玉宇,高处不胜寒。', 'dst_x' => 'center', 'dst_y' => 535, 'font' => 16, 'rgba' => [51, 51, 51, 1]
+ ],
+ [
+ 'content' => '起舞弄清影,何似在人间。转朱阁,低绮户,照无眠。', 'dst_x' => 'center', 'dst_y' => 555, 'font' => 16, 'rgba' => [51, 51, 51, 1]
+ ],
+ [
+ 'content' => '不应有恨,何事长向别时圆?', 'dst_x' => 'center', 'dst_y' => 575, 'font' => 16, 'rgba' => [51, 51, 51, 1]
+ ],
+ [
+ 'content' => '人有悲欢离合,月有阴晴圆缺,此事古难全。', 'dst_x' => 'center', 'dst_y' => 595, 'font' => 16, 'rgba' => [51, 51, 51, 120]
+ ],
+ [
+ 'content' => '但愿人长久,千里共婵娟。', 'dst_x' => 'center', 'dst_y' => 615, 'font' => 16, 'rgba' => [51, 51, 51, 1]
+ ],
+ [
+ 'content' => '长按识别', 'dst_x' => 'center', 'dst_y' => 720, 'font' => 16, 'rgba' => [51, 51, 51, 1]
+ ],
+ [
+ 'content' => '查看TA的更多作品', 'dst_x' => 'center', 'dst_y' => 757, 'font' => 16, 'rgba' => [51, 51, 51, 1], 'max_w' => 0, 'font_family' => '', 'weight' => 1, 'space' => 20
+ ]
+ ];
+ $buildQrManyArr = [
+ [
+ 'text' => 'http://www.520yummy.com', 'dst_x' => 37, 'dst_y' => 692, 'src_x' => 0, 'src_y' => 0, 'src_w' => 0, 'src_h' => 0, 'size' => 4, 'margin' => 1
+ ],
+ [
+ 'text' => 'http://www.520yummy.com', 'dst_x' => 481, 'dst_y' => 692, 'src_x' => 0, 'src_y' => 0, 'src_w' => 0, 'src_h' => 0, 'size' => 4, 'margin' => 1
+ ]
+ ];
+
+ // $result = PosterManager::Poster('poster/poster_user')
+ // ->buildIm(638,826,[255,255,255,1],true)
+ // ->buildImageMany($buildImageManyArr)
+ // ->buildTextMany($buildTextManyArr)
+ // ->buildQrMany($buildQrManyArr)
+ // ->buildBg(638,826,[0,0,0,50],true)
+ // ->buildText('明月几时有,把酒问青天。不知天上宫阙,今夕是何年。','center',100,32,[255, 255, 255, 1])
+ // ->getPoster();
+ $startAt = microtime(true);
+ echo $startAt . PHP_EOL;
+ // $result = PosterManager::Poster('poster/poster_user')
+ // ->buildIm(638,826,[255,255,255,1],true)
+ // ->buildImageMany($buildImageManyArr)
+ // ->buildTextMany($buildTextManyArr)
+ // ->buildQrMany($buildQrManyArr)
+ // ->buildBg(638,826,['color'=>[[0,0,162], [0,255,162], [255,255,162], [255, 0, 0], [0, 255, 0]], 'alpha'=>50, 'to'=>'bottom'],true)
+ // ->buildText('明月几时有,把酒问青天。不知天上宫阙,今夕是何年。','center',100,32,[255, 255, 255, 1])
+ // ->getPoster();
+
+
+ //给图片添加水印
+ // $result = PosterManager::poster()
+ // ->buildImDst(__DIR__.'/poster/poster_user.png')
+ // ->buildImage('https://test.acyapi.51acy.com/wechat/qrcode/poster_241.jpg','25%','65%',0,0,0,0,false)
+ // ->setPoster();
+
+ # 实例化调用
+ // 合成图片
+ // $PosterManager = PosterManager::Poster('poster/test1');//new PosterManager('poster/test1');
+ // $result = $PosterManager
+ // // ->buildIm(638,826,[255,255,255,127],false)
+ // // ->buildImageMany($buildImageManyArr)
+ // // ->buildTextMany($buildTextManyArr)
+ // // ->buildQrMany($buildQrManyArr)
+ // // ->config(['path'=>'poster/test1.png','font_family'=> __DIR__ . '/../src/style/simkai.ttf'])
+
+ // ->buildBg(400, 500, ['color' => [[255, 0, 0],
+ // [255, 125, 0],
+ // [255, 255, 0],
+ // [0, 255, 0],
+ // [0, 255, 255],
+ // [0, 0, 255],
+ // [255, 0, 255]], 'alpha' => 1, 'to' => 'left top', 'radius' => '0'], true, 'center', 'center', 0, 0,
+ // function ($im) {
+ // $im->buildLine(10, 100, 100, 100, [0, 0, 0, 1]);
+ // // $im->buildLine(10, 30, 100, 100, [0, 0, 0, 1], 'rectangle', 10);
+ // // $im->buildLine(120, 10, 220, 100, [0, 0, 0, 1], 'filled_rectangle', 10);
+ // // $im->buildArc(200, 200, 50, 50, 0, 360, [0, 0, 0, 1], 'filled_arc', 1);
+ // $im->buildText('明月几时有,把酒问青天,不知天上宫阙,今夕是何年', 'center', ['custom', 'center', 0, 100, 0], 20, [0, 0, 0, 50], 0, '', 1, 0);
+ // // $im->buildText('明月几时有', ['custom', 'right', 200, 400], ['custom', 'bottom', 200, 500, -20], 20, [0, 0, 0, 50]);
+ // })
+ // ->buildBg(400, 500, ['color' => [[255, 0, 0],
+ // [255, 125, 0],
+ // [255, 255, 0],
+ // [0, 255, 0],
+ // [0, 255, 255],
+ // [0, 0, 255],
+ // [255, 0, 255]], 'alpha' => 1, 'to' => 'left top', 'radius' => '0'], true, 'center', 'center', 0, 0,
+ // function ($im) {
+ // $im->buildLine(10, 100, 100, 100, [0, 0, 0, 1]);
+ // // $im->buildLine(10, 30, 100, 100, [0, 0, 0, 1], 'rectangle', 10);
+ // // $im->buildLine(120, 10, 220, 100, [0, 0, 0, 1], 'filled_rectangle', 10);
+ // // $im->buildArc(200, 200, 50, 50, 0, 360, [0, 0, 0, 1], 'filled_arc', 1);
+ // $im->buildText('明月几时有,把酒问青天,不知天上宫阙,今夕是何年', 'center', ['custom', 'center', 0, 100, 0], 20, [0, 0, 0, 50], 0, '', 1, 0);
+ // // $im->buildText('明月几时有', ['custom', 'right', 200, 400], ['custom', 'bottom', 200, 500, -20], 20, [0, 0, 0, 50]);
+ // })
+ // ->buildBg(400, 500, ['color' => [[255, 0, 0],
+ // [255, 125, 0],
+ // [255, 255, 0],
+ // [0, 255, 0],
+ // [0, 255, 255],
+ // [0, 0, 255],
+ // [255, 0, 255]], 'alpha' => 1, 'to' => 'left top', 'radius' => '0'], true, 'center', 'center', 0, 0,
+ // function ($im) {
+ // $im->buildLine(10, 100, 100, 100, [0, 0, 0, 1]);
+ // // $im->buildLine(10, 30, 100, 100, [0, 0, 0, 1], 'rectangle', 10);
+ // // $im->buildLine(120, 10, 220, 100, [0, 0, 0, 1], 'filled_rectangle', 10);
+ // // $im->buildArc(200, 200, 50, 50, 0, 360, [0, 0, 0, 1], 'filled_arc', 1);
+ // $im->buildText('明月几时有,把酒问青天,不知天上宫阙,今夕是何年', 'center', ['custom', 'center', 0, 100, 0], 20, [0, 0, 0, 50], 0, '', 1, 0);
+ // // $im->buildText('明月几时有', ['custom', 'right', 200, 400], ['custom', 'bottom', 200, 500, -20], 20, [0, 0, 0, 50]);
+ // })
+ // ->buildBg(400, 500, ['color' => [[255, 0, 0],
+ // [255, 125, 0],
+ // [255, 255, 0],
+ // [0, 255, 0],
+ // [0, 255, 255],
+ // [0, 0, 255],
+ // [255, 0, 255]], 'alpha' => 1, 'to' => 'left top', 'radius' => '0'], true, 'center', 'center', 0, 0,
+ // function ($im) {
+ // $im->buildLine(10, 100, 100, 100, [0, 0, 0, 1]);
+ // // $im->buildLine(10, 30, 100, 100, [0, 0, 0, 1], 'rectangle', 10);
+ // // $im->buildLine(120, 10, 220, 100, [0, 0, 0, 1], 'filled_rectangle', 10);
+ // // $im->buildArc(200, 200, 50, 50, 0, 360, [0, 0, 0, 1], 'filled_arc', 1);
+ // $im->buildText('明月几时有,把酒问青天,不知天上宫阙,今夕是何年', 'center', ['custom', 'center', 0, 100, 0], 20, [0, 0, 0, 50], 0, '', 1, 0);
+ // // $im->buildText('明月几时有', ['custom', 'right', 200, 400], ['custom', 'bottom', 200, 500, -20], 20, [0, 0, 0, 50]);
+ // })
+ // ->buildBg(400, 500, ['color' => [[255, 0, 0],
+ // [255, 125, 0],
+ // [255, 255, 0],
+ // [0, 255, 0],
+ // [0, 255, 255],
+ // [0, 0, 255],
+ // [255, 0, 255]], 'alpha' => 1, 'to' => 'left top', 'radius' => '0'], true, 'center', 'center', 0, 0,
+ // function ($im) {
+ // $im->buildLine(10, 100, 100, 100, [0, 0, 0, 1]);
+ // // $im->buildLine(10, 30, 100, 100, [0, 0, 0, 1], 'rectangle', 10);
+ // // $im->buildLine(120, 10, 220, 100, [0, 0, 0, 1], 'filled_rectangle', 10);
+ // // $im->buildArc(200, 200, 50, 50, 0, 360, [0, 0, 0, 1], 'filled_arc', 1);
+ // $im->buildText('明月几时有,把酒问青天,不知天上宫阙,今夕是何年', 'center', ['custom', 'center', 0, 100, 0], 20, [0, 0, 0, 50], 0, '', 1, 0);
+ // // $im->buildText('明月几时有', ['custom', 'right', 200, 400], ['custom', 'bottom', 200, 500, -20], 20, [0, 0, 0, 50]);
+ // })
+ // ->getPoster();
+
+ $result = Poster::extension('gd')
+ // ->config(['path'=>'poster/test1.png', 'font_family'=> __DIR__ . '/../src/style/simkai.ttf'])
+ // ->buildIm(638,826,[255,255,255,1],true)
+ // ->buildImageMany($buildImageManyArr)
+ // ->buildTextMany($buildTextManyArr)
+ // ->buildText('啊实打实大所大所大所多', 100, 200, 20, [255, 255, 255, 1])
+ // ->buildQrMany($buildQrManyArr)
+ ->buildBg(638, 826, ['color' => [[255, 0, 0],
+ [255, 125, 0],
+ [255, 255, 0],
+ [0, 255, 0],
+ [0, 255, 255],
+ [0, 0, 255],
+ [255, 0, 255]], 'alpha' => 50, 'to' => 'left top', 'radius' => '40'], true, 'center', 'center', 0, 0,
+ function ($im) use($buildImageManyArr, $buildTextManyArr, $buildQrManyArr) {
+ $im->buildLine(10, 100, 100, 100, [0, 0, 0, 1]);
+ $im->buildImageMany($buildImageManyArr);
+ $im->buildTextMany($buildTextManyArr);
+ $im->buildQrMany($buildQrManyArr);
+ // $im->buildLine(10, 30, 100, 100, [0, 0, 0, 1], 'rectangle', 10);
+ // $im->buildLine(120, 10, 220, 100, [0, 0, 0, 1], 'filled_rectangle', 10);
+ // $im->buildArc(200, 200, 50, 50, 0, 360, [0, 0, 0, 1], 'filled_arc', 1);
+ $im->buildText('明月几时有,把酒问青天,不知天上宫阙,今夕是何年', 'center', ['custom', 'center', 0, 100, 0], 20, [0, 0, 0, 50], 0, '', 10, 25);
+ // $im->buildText('明月几时有', ['custom', 'right', 200, 400], ['custom', 'bottom', 200, 500, -20], 20, [0, 0, 0, 50]);
+ })
+ ->getPoster();
+ echo (memory_get_usage() / 1024 / 1024) . 'M' . PHP_EOL;
+ echo (memory_get_peak_usage() / 1024 / 1024) . 'M' . PHP_EOL;
+ print_r(getrusage()) . PHP_EOL;
+
+ $endAt = microtime(true);
+ echo $endAt . PHP_EOL;
+ echo $endAt - $startAt . PHP_EOL;
+
+ //给图片添加水印
+ // $PosterManager = new PosterManager();
+ // $result = $PosterManager->buildImDst(__DIR__.'/test.jpeg')
+ // ->buildImage('https://test.acyapi.51acy.com/wechat/qrcode/poster_241.jpg','center','-20%',0,0,0,0,true)
+ // ->setPoster();
+
+ //生成二维码
+ /**
+ * [Qr description]
+ * @Author lang
+ * @Date 2020-10-14T10:59:28+0800
+ * @param [type] $text [二维码包含的内容,可以是链接、文字、json字符串等等]
+ * @param [type] $outfile [默认为false,不生成文件,只将二维码图片返回输出;否则需要给出存放生成二维码图片的文件名及路径]
+ * @param [type] $level [容错级别,默认为L]
+ * 可传递的值分别是L(QR_ECLEVEL_L,7%)、M(QR_ECLEVEL_M,15%)、Q(QR_ECLEVEL_Q,25%)、H(QR_ECLEVEL_H,30%)。
+ * 这个参数控制二维码容错率,不同的参数表示二维码可被覆盖的区域百分比,也就是被覆盖的区域还能识别
+ * @param [type] $size [控制生成图片的大小,默认为4]
+ * @param [type] $margin [控制生成二维码的空白区域大小]
+ * @param [type] $saveAndPrint [保存二维码图片并显示出来,$outfile必须传递图片路径]
+ * @return [type] [description]
+ */
+ # 静态调用
+ // $result = PosterManager::Poster()->Qr('http://www.baidu.com','poster/1.png');
+ # 实例化调用
+ // $PosterManager = new PosterManager();
+ // $result = $PosterManager->Qr('http://www.baidu.com','poster/1.png', 'L', 4, 1, 1);
+ print_r($result);
+ exit;
+} catch (Exception $e) {
+ echo $e->getMessage();
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/tests/server/bg.php b/niucloud/vendor/kkokk/poster/tests/server/bg.php
new file mode 100644
index 000000000..8346571ec
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/tests/server/bg.php
@@ -0,0 +1,37 @@
+config(
+ [
+ 'path' => __DIR__ . '/../poster/test1.png',
+ ]
+ )
+ ->buildIm(500, 600, [255, 255, 255, 127], true)
+ ->buildBg(400,400,[
+ 'color'=>[
+ [0,0,162],
+ [0,255,162],
+ [255,255,162],
+ [255, 0, 0],
+ [0, 255, 0]
+ ],
+ 'alpha'=>0,
+ 'to'=>'bottom',
+ 'radius'=>20,
+ 'content_alpha' => 20
+ ], true, 'center', 'center', 0, 0 , function($im){
+ /** @var \Kkokk\Poster\Image\Builder $im */
+ $im->buildText('明月几时有,把酒问青天。不知天上宫阙,今夕是何年。','center',100,20,[255, 255, 255, 1]);
+ })->getPoster(); # 创建画布
+} catch (\Exception $e) {
+ print_r($e);
+}
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/tests/server/captcha.php b/niucloud/vendor/kkokk/poster/tests/server/captcha.php
new file mode 100644
index 000000000..674c63023
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/tests/server/captcha.php
@@ -0,0 +1,14 @@
+type('click')->get();
+
+print_r($res);
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/tests/server/html.php b/niucloud/vendor/kkokk/poster/tests/server/html.php
new file mode 100644
index 000000000..a1612ead8
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/tests/server/html.php
@@ -0,0 +1,86 @@
+buildQr('https://www.baidu.com',0, 0, 0, 0, 300, 300)
+ ->buildImage('https://portrait.gitee.com/uploads/avatars/user/721/2164500_langlanglang_1601019617.png', 'center', 'center', 0, 0, 50, 50)
+ ->stream();
+exit;
+
+
+$html = <<
+
+
+
+
+
+ 你好
+
+
+
+
+
你好,世界
+
+
+
+eol;
+
+
+$img = Html::channel('wk')->load($html)->transparent()->size(338, 426)->render();
+
+// header('Content-Type:Image/png');
+// echo $img->getImageBlob();
+// exit;
+
+$result = Poster::extension('gd')
+ ->config([
+ 'path' => __DIR__ . '/../poster/test1.png',
+ // 'font' => 'static/simkai.ttf',
+ // 'dpi' => 72
+ ])
+ ->buildIm(638, 826, [41, 43, 48, 127], false)
+ // ->buildImage('https://test.acyapi.51acy.com/wechat/poster/top_bg.png')
+ // ->buildImage('static/top_bg.png')
+ // ->buildImage('https://test.acyapi.51acy.com/wechat/poster/half_circle.png', 254, 321)
+ ->buildImage([
+ // 'src' => __DIR__ . '/../poster/1689560381.png',
+ 'src' => $img->getImageBlob(),
+ 'angle' => 0
+ ], 'center', 'center')
+ ->buildImage([
+ 'src' => 'https://portrait.gitee.com/uploads/avatars/user/721/2164500_langlanglang_1601019617.png',
+ 'angle' => 80
+ ], 253, 326, 0, 0, 131, 131, false, 'circle')
+ // ->buildImage('https://test.acyapi.51acy.com/wechat/poster/fengexian.png', 0, 655)
+ // ->buildImage('https://test.acyapi.51acy.com/wechat/qrcode/poster_241.jpg',37,692,0,0,122,122)
+ // ->buildText('明月几时有,把酒问青天', ['center'], 200, 20, [52, 52, 52, 2], 0, '', 1, 40)
+ // ->buildText('明月几时有,把酒问青天', ['center'], 300, 20, [52, 52, 52, 2], 0, '', 1, 40)
+ ->buildText('苏轼', 'center', 477, 16, [255, 255, 255, 1])
+ ->buildText('明月几时有,把酒问青天。不知天上宫阙,今夕是何年。', 'center', 515, 14, [255, 255, 255, 1])
+ ->stream();
\ No newline at end of file
diff --git a/niucloud/vendor/kkokk/poster/tests/server/index.php b/niucloud/vendor/kkokk/poster/tests/server/index.php
new file mode 100644
index 000000000..e5f74d28e
--- /dev/null
+++ b/niucloud/vendor/kkokk/poster/tests/server/index.php
@@ -0,0 +1,9 @@
+ 'html', 'content' => '我是
某某,
我在贵阳
我为家乡助力
我是
第0位岑巩好物代言人,海报生成图片验证极速生成方便快捷快速生成海报'];
+// // $msg1 = '我是某某,我在贵阳,我为家乡助力,我是第336位岑巩好物代言人,海报生成图片验证极速生成方便快捷快速生成海报';
+// // $msg2 = ['type' => 'html', 'content' => '我是某某,我在贵阳,我为家乡助力,我是第336位岑巩好物代言人,海报生成图片验证极速生成方便快捷快速生成海报'];
+//
+// Poster::extension('gd')
+// ->config([
+// 'path' => __DIR__ . '/../poster/text1.png'
+// ])
+// ->buildIm(638, 826, [255, 255, 255, 127], false)
+// ->buildText($msg1, ['center'], 200, 20, [52, 52, 52, 1], 300, '', 1, 0)
+// ->getPoster();
+// exit;
+// Poster::extension('imagick')
+// ->config([
+// 'path' => __DIR__ . '/../poster/text2.png'
+// ])
+// ->buildIm(638, 826, [255, 255, 255, 127], false)
+// ->buildText($msg2, ['center'], 200, 20, [52, 52, 52, 1], 300, '', 1, 0)
+// ->getPoster();
+
+// Poster::extension('gd')
+// ->config([
+// 'path' => __DIR__ . '/../poster/text3.png'
+// ])
+// ->buildIm(638, 826, [255, 255, 255, 127], false)
+// ->buildText($msg1, ['center'], 200, 20, [52, 52, 52, 1], 300, '', 1, 0)
+// ->getPoster();
+
+// Poster::extension('gd')
+// ->config([
+// 'path' => __DIR__ . '/../poster/text4.png'
+// ])
+// ->buildIm(638, 826, [255, 255, 255, 127], false)
+// ->buildText($msg2, ['center'], 200, 20, [52, 52, 52, 1], 300, '', 1, 0)
+// ->getPoster();
+// 验证码
+// $result = Captcha::type('click')->get();
+// echo <<
+// EOF;
+// exit;
+
+// 加水印
+// $result = Poster::extension('imagick')
+// ->config([
+// 'path' => 'poster/test1.png',
+// 'font' => __DIR__ . '/../../src/style/simkai.ttf',
+// ])
+// ->buildImDst('../poster/click.png')
+// ->buildText('加一个水印', 5, 55, 16, [255, 255, 255, 50], 0, '', 1, 0, 315)
+// ->buildText('加一个水印', -15, 125, 16, [255, 255, 255, 50], 0, '', 1, 0, 315)
+// ->buildText('加一个水印', 55, 55, 16, [255, 255, 255, 50], 0, '', 1, 0, 315)
+// ->stream();
+// echo $result;
+// exit;
+
+
+$result = Poster::extension('imagick')
+ ->config([
+ 'path' => __DIR__ . '/../poster/test1.png',
+ // 'font' => 'static/simkai.ttf',
+ // 'dpi' => 72
+ ])
+ ->buildIm(638, 826, [41, 43, 48, 127], false)
+ // ->buildImage('https://test.acyapi.51acy.com/wechat/poster/top_bg.png')
+ // ->buildImage('static/top_bg.png')
+ // ->buildImage('https://test.acyapi.51acy.com/wechat/poster/half_circle.png', 254, 321)
+ ->buildImage([
+ // 'src' => __DIR__ . '/../poster/1689560381.png',
+ 'src' => 'https://img.zmtc.com/2019/1220/20191220080912614.jpg',
+ 'angle' => 420
+ ], 0,0, 0, 0, 360, 640)
+ ->buildImage([
+ 'src' => 'https://portrait.gitee.com/uploads/avatars/user/721/2164500_langlanglang_1601019617.png',
+ 'angle' => 80
+ ], 253, 326, 0, 0, 131, 131, false, 'circle')
+ // ->buildImage('https://test.acyapi.51acy.com/wechat/poster/fengexian.png', 0, 655)
+ // ->buildImage('https://test.acyapi.51acy.com/wechat/qrcode/poster_241.jpg',37,692,0,0,122,122)
+ // ->buildText('明月几时有,把酒问青天', ['center'], 200, 20, [52, 52, 52, 2], 0, '', 1, 40)
+ // ->buildText('明月几时有,把酒问青天', ['center'], 300, 20, [52, 52, 52, 2], 0, '', 1, 40)
+ ->buildText('苏轼', 'center', 477, 16, [255, 255, 255, 1])
+ ->buildText('明月几时有,把酒问青天。不知天上宫阙,今夕是何年。', 'center', 515, 14, [255, 255, 255, 1])
+ // ->buildText('长按识别', 497, 720, 15, [153, 153, 153, 1])
+ // ->buildText('查看TA的更多作品', 437, 757, 15, [153, 153, 153, 1])
+ // ->buildQr('http://www.baidu.com', 37, 692, 0, 0, 122, 122)
+ // ->buildBg(400, 500, ['color' => [
+ // [255, 0, 0],
+ // [255, 125, 0],
+ // [255, 255, 0],
+ // [0, 255, 0],
+ // [0, 255, 255],
+ // [0, 0, 255],
+ // [255, 0, 255]
+ // ], 'alpha' => 80, 'to' => 'top', 'radius' => '20 30 40 80'], true, 'center', 'center', 0, 0,
+ // function ($im) {
+ // // $im->buildImage('https://test.acyapi.51acy.com/wechat/poster/top_bg.png');
+ // $im->buildLine(10, 100, 100, 200, [0, 0, 0, 1], '', 10);
+ // // $im->buildLine(10, 30, 100, 100, [0, 0, 0, 1], 'rectangle', 10);
+ // // $im->buildLine(120, 10, 220, 100, [0, 0, 0, 1], 'filled_rectangle', 10);
+ // $im->buildArc(200, 200, 50, 50, 0, 360, [0, 0, 0, 1], '', 1);
+ // $im->buildText('明月几时有,把酒问青天,不知天上宫阙,今夕是何年', 'center', ['custom', 'center', 0, 100, 0], 20, [0, 0, 0, 50], 0, '', 1, 0);
+ // // $im->buildText('明月几时有', ['custom', 'right', 200, 400], ['custom', 'bottom', 200, 500, -20], 20, [0, 0, 0, 50]);
+ // })
+ ->stream();
+
+// echo (memory_get_usage() / 1024 / 1024) . 'M' . PHP_EOL;
+// echo (memory_get_peak_usage() / 1024 / 1024) . 'M' . PHP_EOL;
+// print_r(getrusage()) . PHP_EOL;
+//
+// $endAt = microtime(true);
+// echo $endAt . PHP_EOL;
+// echo $endAt - $startAt . PHP_EOL;
\ No newline at end of file
diff --git a/niucloud/vendor/services.php b/niucloud/vendor/services.php
index f383fad85..2bbc02f03 100644
--- a/niucloud/vendor/services.php
+++ b/niucloud/vendor/services.php
@@ -1,5 +1,5 @@
'think\\captcha\\CaptchaService',
diff --git a/niucloud/vendor/w7corp/easywechat/src/Kernel/Support/XML.php b/niucloud/vendor/w7corp/easywechat/src/Kernel/Support/XML.php
deleted file mode 100644
index 785da795e..000000000
--- a/niucloud/vendor/w7corp/easywechat/src/Kernel/Support/XML.php
+++ /dev/null
@@ -1,158 +0,0 @@
-|null
- */
- public static function parse(string $xml): array|null
- {
- if (empty($xml)) {
- return null;
- }
-
- $xml = simplexml_load_string(
- self::sanitize($xml),
- 'SimpleXMLElement',
- LIBXML_COMPACT | LIBXML_NOCDATA | LIBXML_NOBLANKS
- );
-
- if (!$xml) {
- throw new InvalidArgumentException('Invalid XML');
- }
-
- return self::normalize($xml);
- }
-
- /**
- * @param array $data
- * @param string $root
- * @param string $item
- * @param string|array $attr
- * @param string $id
- *
- * @return string
- */
- public static function build(
- array $data,
- string $root = 'xml',
- string $item = 'item',
- string|array $attr = '',
- string $id = 'id'
- ): string {
- if (is_array($attr)) {
- $segments = [];
-
- foreach ($attr as $key => $value) {
- /** @phpstan-ignore-next-line */
- $segments[] = "{$key}=\"{$value}\"";
- }
-
- $attr = implode(' ', $segments);
- }
-
- $attr = trim($attr);
- $attr = empty($attr) ? '' : " {$attr}";
- $xml = "<{$root}{$attr}>";
- $xml .= self::data2Xml($data, $item, $id);
- $xml .= "{$root}>";
-
- return $xml;
- }
-
- public static function cdata(?string $string): string
- {
- return sprintf('', $string ?? '');
- }
-
- /**
- * @psalm-suppress RedundantCondition
- * @param array|SimpleXMLElement $object
- * @return array|null
- */
- protected static function normalize(SimpleXMLElement|array $object): array|null
- {
- $result = null;
-
- if (is_object($object)) {
- $object = (array) $object;
- }
-
- if (is_array($object)) {
- foreach ($object as $key => $value) {
- $value = $value instanceof SimpleXMLElement ? self::normalize($value) : $value;
-
- if ('@attributes' === $key) {
- $result = $value; // @codeCoverageIgnore
- } else {
- $result[$key] = $value;
- }
- }
- }
-
- return $result;
- }
-
- /**
- * @param array $data
- * @param string $item
- * @param string $id
- *
- * @return string
- */
- protected static function data2Xml(array $data, string $item = 'item', string $id = 'id'): string
- {
- $xml = $attr = '';
-
- foreach ($data as $key => $val) {
- if (is_numeric($key)) {
- $attr = " {$id}=\"{$key}\"";
- $key = $item;
- }
-
- $xml .= "<{$key}{$attr}>";
-
- if ((is_array($val) || is_object($val))) {
- $xml .= self::data2Xml((array) $val, $item, $id);
- } else {
- /** @phpstan-ignore-next-line */
- $xml .= is_numeric($val) ? $val : self::cdata($val);
- }
-
- $xml .= "{$key}>";
- }
-
- return $xml;
- }
-
- /**
- * Delete invalid characters in XML.
- *
- * @see https://www.w3.org/TR/2008/REC-xml-20081126/#charsets - XML charset range
- * @see http://php.net/manual/en/regexp.reference.escape.php - escape in UTF-8 mode
- *
- * @param ?string $xml
- *
- * @return string
- */
- public static function sanitize(?string $xml): string
- {
- if (empty($xml)) {
- return '';
- }
-
- return preg_replace(
- '/[^\x{9}\x{A}\x{D}\x{20}-\x{D7FF}\x{E000}-\x{FFFD}\x{10000}-\x{10FFFF}]+/u',
- '',
- $xml
- ) ?? '';
- }
-}