header("Content-Type", $mimetype); // 直接显示二维码 // header('Content-Type: ' . $qrcode_service->getContentType()); // $response->content($qrcode_service->writeString()); $qrcodePath = ROOT_PATH . 'public/uploads/qrcode/'; if (!is_dir($qrcodePath)) { @mkdir($qrcodePath); } if (is_really_writable($qrcodePath)) { $filename = md5(implode('', $params)) . '.png'; $filePath = $qrcodePath . $filename; $qrcode_service->writeFile($filePath); } return '/uploads/qrcode/' . $filename; } //生成视频分享海报 public function shareposter() { $inviteimage = $this->inviteimage($this->auth->introcode); $data = [ [ "left"=> "140px", "top"=> "120px", "type"=> "img", "width"=> "50px", "height"=> "50px", "src"=> localpath_to_netpath($this->auth->avatar)//"https://metavision.oss-cn-hongkong.aliyuncs.com/uploads/20220615/f00cb545deb4c4e7296f444239d83e84.jpg" ], [ "left"=> "95px", "top"=> "190px", "type"=> "nickname", "width"=> "166px", "height"=> "38px", "size"=> "11px", "color"=> "#FFFFFF", "content" => '这里真心不错,推荐你来', ], [ "left"=> "105px", "top"=> "400px", "type"=> "nickname", "width"=> "166px", "height"=> "38px", "size"=> "11px", "color"=> "#333333", "content" => '邀请码:'.$this->auth->introcode, ], [ "left"=> "100px", "top"=> "265px", "type"=> "img", "width"=> "130px", "height"=> "130px", "src"=> httpurllocal($inviteimage)//"https://metavision.oss-cn-hongkong.aliyuncs.com/uploads/20220615/f00cb545deb4c4e7296f444239d83e84.jpg" ], ]; $data = json_encode($data, 320); $poster = [ 'id' => 1, 'title' => '测试', 'waittext' => '您的专属海报正在拼命生成中,请等待片刻...', 'bg_image' => '/assets/img/posteruserbg.png', 'data' => $data, 'status' => 'normal', 'weigh' => 0, 'createtime' => 1653993709, 'updatetime' => 1653994259, ]; $image = new \addons\poster\library\Image(); $imgurl = $image->createPosterImage($poster, $this->auth->getUser()); if (!$imgurl) { $this->error('生成海报出错'); } $imgurl = $_SERVER["REQUEST_SCHEME"]."://".$_SERVER["HTTP_HOST"] . '/' . $imgurl; //echo '