1.生成二维码
public function Qrcode($rootNo)
{
//创建画板
$this->imgObj = self::canvas(320, 320);
/****
* 生成二维码
*/
$dir_path = public_path('image/basket');
if(!is_dir($dir_path)){
mkdir($dir_path,0777, true);
}
$imgName = date('Ymd').'_'.$rootNo.'.png';
$imgNamePath = $dir_path.'/'.$imgName;
QrCode::format('png')->size(320)->generate($rootNo, $imgNamePath);
$QrCodeImg = Image::make($imgNamePath)->resize(320, 320);
$this->imgObj->insert($QrCodeImg, 'bottom',10, 10);
$this->imgObj->text("设备码:".$rootNo, 160, 300, function ($font) {
$font->file(GeneratorMemberImage::getFontPath());
$font->size(20);
$font->color('#333333');
$font->align('center');
$fon
|