|
19 | 19 |
|
20 | 20 | namespace FacturaScripts\Core\Lib; |
21 | 21 |
|
22 | | -use Endroid\QrCode\Color\Color; |
23 | | -use Endroid\QrCode\QrCode; |
24 | | -use Endroid\QrCode\Writer\PngWriter; |
| 22 | +use chillerlan\QRCode\QRCode; |
| 23 | +use chillerlan\QRCode\QROptions; |
25 | 24 | use PragmaRX\Google2FA\Google2FA; |
26 | 25 | use Exception; |
27 | 26 | use FacturaScripts\Core\Tools; |
@@ -83,14 +82,16 @@ public static function getQRCodeUrl(string $companyName, string $email, string $ |
83 | 82 | public static function getQRCodeImage(string $url): string |
84 | 83 | { |
85 | 84 | try { |
86 | | - $qrCode = QrCode::create($url) |
87 | | - ->setSize(self::QR_CODE_SIZE) |
88 | | - ->setForegroundColor(new Color(0, 0, 0)) |
89 | | - ->setBackgroundColor(new Color(255, 255, 255)); |
| 85 | + $options = new QROptions([ |
| 86 | + 'version' => QRCode::VERSION_AUTO, |
| 87 | + 'outputType' => QRCode::OUTPUT_IMAGE_PNG, |
| 88 | + 'eccLevel' => QRCode::ECC_L, |
| 89 | + 'scale' => 10, |
| 90 | + 'imageBase64' => true, |
| 91 | + ]); |
90 | 92 |
|
91 | | - $writer = new PngWriter(); |
92 | | - $result = $writer->write($qrCode); |
93 | | - return $result->getDataUri(); |
| 93 | + $qrcode = new QRCode($options); |
| 94 | + return $qrcode->render($url); |
94 | 95 | } catch (Exception $e) { |
95 | 96 | Tools::log()->error('error-generating-qr-code', [ |
96 | 97 | '%message%' => $e->getMessage(), |
|
0 commit comments