Synthesis.php
898 字节
1
2
3
4
5
6
7
8
9
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
36
37
38
39
40
<?php
namespace app\server;
use Kkokk\Poster\PosterManager;
use Kkokk\Poster\Exception\Exception;
class Synthesis{
/**
* 图片合成
* $qrcode 二维码
*/
static public function buildImDst($qrcode){
$saveHBPath = '';// # 设置保存路径和文件名
$poster = PosterManager::Poster($saveHBPath);
$BGPath = '';//背景图路径
$poster->buildImDst($BGPath);
//根据背景图的大小调整
$dst_x=408;
$dst_y=731;
$src_x=0;
$src_y=0;
$size=4;
$margin=1;
$result = $poster->buildImage('http://localhost/'.$qrcode,$dst_x,$dst_y,$src_x,$src_y)->getPoster(); # 合成二维码
return $result;
}
/**创建二维码 186x186 */
static public function qrcode($url){
try{
$qrcodePath = ROOT_PATH . 'public/uploads/qrcode/';
$res = PosterManager::Poster()->Qr($url,$qrcodePath,'H',6);
}catch(\Exception $e){
abort(404,$e->getMessage());
}
}
}