<?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($LTC5O, $xR91w = 200) { goto k701l; k701l: if (class_exists(\BaconQrCode\Renderer\Image\Png::class)) { goto vdHL2; vdHL2: $sF52V = new \BaconQrCode\Renderer\Image\Png(); goto cRnpP; T0J2g: $sF52V->setWidth($xR91w); goto OBngI; cRnpP: $sF52V->setMargin(0); goto SSvcs; SSvcs: $sF52V->setHeight($xR91w); goto T0J2g; OBngI: } else { BizException::throwsIf('Please Install imagick extension', !extension_loaded('imagick')); $sF52V = new \BaconQrCode\Renderer\ImageRenderer(new \BaconQrCode\Renderer\RendererStyle\RendererStyle(400), new \BaconQrCode\Renderer\Image\ImagickImageBackEnd()); } goto L8rsS; L8rsS: $TBXTp = new \BaconQrCode\Writer($sF52V); goto xrfSq; xrfSq: return $TBXTp->writeString($LTC5O, 'UTF-8'); goto Uveqo; Uveqo: } public static function pngBase64String($LTC5O, $xR91w = 200) { return 'data:image/png;base64,' . base64_encode(self::png($LTC5O, $xR91w)); } }