This commit is contained in:
wangjinlei
2021-07-26 14:27:01 +08:00
parent 8ea54fdcc2
commit 3ae9be1e60
7 changed files with 163 additions and 67 deletions

View File

@@ -10,7 +10,11 @@ class img {
public function fire(Job $job, $data) {
// $this->tttt($data['name']);
$this->imgCL($data['name'], $data['course']);
if ($data['course'] == 'ZYMR') {
$this->imgCL($data['name'], $data['course']);
} else {
$this->imgZL($data['name'], $data['course']);
}
$job->delete();
}
@@ -38,7 +42,29 @@ class img {
$image->text($name, $ziti, 50, '#000000', $lim)
->text('NO.ZYMR' . (20210619001 + $max), $ziti, 25, '#000000', [573, 650])
->save(ROOT_PATH . 'public' . DS . 'zhengshu' . DS . 'img' . DS . $course . DS . (1 + $max) . '_' . $name . '.png');
}
/**
* 处理图片主方法
*/
public function imgZL($name, $course) {
$max = $this->getmax($course);
$lim = [];
if (preg_match("/^[\x7f-\xff]+$/", $name) && strlen($name) == 9) {
$lim = [640, 890];
} else if (preg_match("/^[\x7f-\xff]+$/", $name) && strlen($name) == 6) {
$lim = [670, 890];
} else {
$left = (730 - ((35 * strlen($name)) / 2));
$lim = [$left, 890];
}
$template = ROOT_PATH . 'public' . DS . 'zhengshu' . DS . 'template1.png';
$ziti = ROOT_PATH . 'public' . DS . 'zhengshu' . DS . 'siyuan.ttf';
$image = \think\Image::open($template);
$image->text($name, $ziti, 50, '#000000', $lim)
->text('NO.ZLLJ' . (20210807001 + $max), $ziti, 30, '#000000', [573, 660])
->save(ROOT_PATH . 'public' . DS . 'zhengshu' . DS . 'img' . DS . $course . DS . (1 + $max) . '_' . $name . '.png');
}
/**
* 获取当前证书流水号最大值