|
@@ -665,6 +665,82 @@ class User extends BaseController
|
|
|
return app('json')->success(["qrcode"=>$res["url"],"bgimg"=>$bgimg]);
|
|
return app('json')->success(["qrcode"=>$res["url"],"bgimg"=>$bgimg]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+// public function getWxmpInviteQrcode2(Request $request){
|
|
|
|
|
+//
|
|
|
|
|
+// //获取小程序码
|
|
|
|
|
+// $weixinA = new weixina();
|
|
|
|
|
+// $data = $weixinA->getUnlimitedQRCode("pages/index/index","scene=".$request->user["uid"]);
|
|
|
|
|
+// if(empty($data)){
|
|
|
|
|
+// return app('json')->fail("小程序码获取失败".$weixinA->error);
|
|
|
|
|
+// }
|
|
|
|
|
+// $base64 = 'data:'.$data['contentType'].';base64,'.base64_encode($data['buffer']);
|
|
|
|
|
+// $code = "temp";
|
|
|
|
|
+// $sysData = (new SysModel())->where("id",1)->find();
|
|
|
|
|
+// $uploadConfig = config('filesystem');
|
|
|
|
|
+// //验证base64格式
|
|
|
|
|
+// preg_match('/^(data:\s*image\/(\w+);base64,)/',$base64, $result);
|
|
|
|
|
+// if(!$result){
|
|
|
|
|
+// return ["code"=>-1,"msg"=>"base64格式格式错误"];
|
|
|
|
|
+// }
|
|
|
|
|
+// //验证图片后缀
|
|
|
|
|
+// if (!in_array($result[2], $uploadConfig['image']['ext'], true)) {
|
|
|
|
|
+// return ["code"=>-1,"msg"=>"不支持的图片格式"];
|
|
|
|
|
+// }
|
|
|
|
|
+// $rootPath = config('filesystem.disks.resource.root');
|
|
|
|
|
+// $hashName = $code.DIRECTORY_SEPARATOR.date('Ymd') . DIRECTORY_SEPARATOR . md5((string) microtime(true)).".".$result[2];
|
|
|
|
|
+// $filePath = $rootPath. DIRECTORY_SEPARATOR .$hashName;
|
|
|
|
|
+// $path = dirname($filePath);
|
|
|
|
|
+// // 检测目录
|
|
|
|
|
+// if (!is_dir($path)) {
|
|
|
|
|
+// if (!mkdir($path, 0777, true)) {
|
|
|
|
|
+// return ["code"=>-1,"msg"=>"生成目录失败"];
|
|
|
|
|
+// }
|
|
|
|
|
+// return ["code"=>-1,"msg"=>"上传目录不存在"];
|
|
|
|
|
+// }
|
|
|
|
|
+// //重名文件验证
|
|
|
|
|
+// if (is_file($filePath)) {
|
|
|
|
|
+// return ["code"=>-1,"msg"=>"文件已存在"];
|
|
|
|
|
+// }
|
|
|
|
|
+// if(!file_put_contents($filePath, base64_decode(str_replace($result[1], '', $base64)))){
|
|
|
|
|
+// return ["code"=>-1,"msg"=>"文件报错失败"];
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// //获取海报背景
|
|
|
|
|
+// $inviteData = (new SysModel)->getDataInfo("invite");
|
|
|
|
|
+// if(empty($inviteData["img"])){
|
|
|
|
|
+// return ["code"=>-1,"msg"=>"海报背景不存在"];
|
|
|
|
|
+// }
|
|
|
|
|
+// $bgimg =explode("resource", $inviteData["img"])[1];
|
|
|
|
|
+// if(empty($bgimg)){
|
|
|
|
|
+// return ["code"=>-1,"msg"=>"海报背景不存在"];
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// $savePath = $rootPath. DIRECTORY_SEPARATOR .$code.DIRECTORY_SEPARATOR.date('Ymd') . DIRECTORY_SEPARATOR . md5((string) microtime(true))."b".".jpg";
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// $bg = $rootPath.$bgimg;
|
|
|
|
|
+// $bgSize = getimagesize($bg);
|
|
|
|
|
+// $qrcodeSize = getimagesize($filePath);
|
|
|
|
|
+// $handle = Image::open($bg);
|
|
|
|
|
+// $handle->water($filePath,[($bgSize[0]-$qrcodeSize[0])/2,($bgSize[1]-$qrcodeSize[1])/2]);
|
|
|
|
|
+// $handle->save($savePath,"jpg",80);
|
|
|
|
|
+// $qiniu = new Qiniu;
|
|
|
|
|
+// $img_url = $qiniu->updateFile('img', $savePath, $savePath);
|
|
|
|
|
+// if (empty($img_url['url'])) {
|
|
|
|
|
+// return ["code"=>-1,"msg"=>"文件报错失败:".$qiniu->getError()];
|
|
|
|
|
+// }
|
|
|
|
|
+// @unlink($filePath);
|
|
|
|
|
+// @unlink($savePath);
|
|
|
|
|
+// return ["code"=>1,"url"=>str_replace("\\", "/", $img_url['url'])];
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// public function checkImgPath(){
|
|
|
|
|
+//
|
|
|
|
|
+// }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 图片合成
|
|
* 图片合成
|
|
|
* @param type $bg
|
|
* @param type $bg
|
|
@@ -678,11 +754,7 @@ class User extends BaseController
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- $bgSize = getimagesize($bg);
|
|
|
|
|
- $qrcodeSize = getimagesize($qrcode);
|
|
|
|
|
- $handle = Image::open($bg);
|
|
|
|
|
- $handle->water($qrcode,[($bgSize[0]-$qrcodeSize[0])/2,($bgSize[1]-$qrcodeSize[1])/2]);
|
|
|
|
|
- $handle->save($savePath,"jpg",80);
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|