<?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($BWI89, $IiMdC = 200) { goto qoLux; vAZzQ: return $RDTvg->writeString($BWI89, 'UTF-8'); goto sxIY6; B2O0Y: $RDTvg = new \BaconQrCode\Writer($YBzKH); goto vAZzQ; qoLux: if (class_exists(\BaconQrCode\Renderer\Image\Png::class)) { goto zZYcz; bq_Uh: $YBzKH->setMargin(0); goto oEAHn; oEAHn: $YBzKH->setHeight($IiMdC); goto izsCM; izsCM: $YBzKH->setWidth($IiMdC); goto KmcMO; zZYcz: $YBzKH = new \BaconQrCode\Renderer\Image\Png(); goto bq_Uh; KmcMO: } else { BizException::throwsIf('Please Install imagick extension', !extension_loaded('imagick')); $YBzKH = new \BaconQrCode\Renderer\ImageRenderer(new \BaconQrCode\Renderer\RendererStyle\RendererStyle(400), new \BaconQrCode\Renderer\Image\ImagickImageBackEnd()); } goto B2O0Y; sxIY6: } public static function pngBase64String($BWI89, $IiMdC = 200) { return 'data:image/png;base64,' . base64_encode(self::png($BWI89, $IiMdC)); } }