<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Util; use BaconQrCode\Encoder\Encoder; use ModStart\Core\Exception\BizException; use ModStart\ModStart; class QrcodeUtil { public static function png($ohNZt, $TUjAS = 200) { goto AGoTk; rEB_9: return $CdF4C->writeString($ohNZt, 'UTF-8'); goto SfpRG; hK7Yw: $CdF4C = new \BaconQrCode\Writer($WhBzN); goto rEB_9; AGoTk: if (class_exists(\BaconQrCode\Renderer\Image\Png::class)) { goto ZP0y9; UeHyf: $WhBzN->setHeight($TUjAS); goto ljVyU; ZP0y9: $WhBzN = new \BaconQrCode\Renderer\Image\Png(); goto bzYwO; ljVyU: $WhBzN->setWidth($TUjAS); goto Qh4xS; bzYwO: $WhBzN->setMargin(0); goto UeHyf; Qh4xS: } else { BizException::throwsIf('Please Install imagick extension', !extension_loaded('imagick')); $WhBzN = new \BaconQrCode\Renderer\ImageRenderer(new \BaconQrCode\Renderer\RendererStyle\RendererStyle(400), new \BaconQrCode\Renderer\Image\ImagickImageBackEnd()); } goto hK7Yw; SfpRG: } public static function pngBase64String($ohNZt, $TUjAS = 200) { return 'data:image/png;base64,' . base64_encode(self::png($ohNZt, $TUjAS)); } }