12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- namespace App\Servers;
- use SimpleSoftwareIO\QrCode\Facades\QrCode;
- /**
- * 图片OSS管理
- */
- class ImgServer
- {
- static private $server = '';
- private function __construct()
- {
- }
- /**
- * 创建对象
- * @return ImgServer
- */
- static function creatServer()
- {
- if (empty(self::$server)) {
- self::$server = new ImgServer();
- }
- return self::$server;
- }
- /**
- * 会员code码生成
- * @param $address
- * @return string
- */
- function setCoinImg($address)
- {
- $dir='code/icon/'.date('Ymd').'/';
- CommonServer::creatServer()->creatDir($dir);
- $fileName=$dir.md5($address).time().'.png';
- $code_img = public_path($fileName);
- if (!is_file($code_img)) {
- file_put_contents($code_img, QrCode::format('png')->size(600)->margin(1)->generate($address));
- }
- return $code_img;
- }
- }
|