diff --git a/composer.json-dist b/composer.json-dist index 6e9bb03abf7..12ff596e77f 100644 --- a/composer.json-dist +++ b/composer.json-dist @@ -19,7 +19,7 @@ "roundcube/plugin-installer": "~0.3.0", "roundcube/rtf-html-php": "~2.1", "masterminds/html5": "~2.7.0", - "endroid/qr-code": "~1.6.5", + "endroid/qr-code": "~4.2.0", "guzzlehttp/guzzle": "^6.5.5" }, "require-dev": { diff --git a/program/actions/contacts/qrcode.php b/program/actions/contacts/qrcode.php index 03b423c1b1a..98577c5f590 100644 --- a/program/actions/contacts/qrcode.php +++ b/program/actions/contacts/qrcode.php @@ -80,17 +80,17 @@ public static function contact_qrcode($contact) $data = $vcard->export(); - $qrCode = new Endroid\QrCode\QrCode(); + $qrCode = new Endroid\QrCode\QrCode($data); $qrCode - ->setText($data) + ->setEncoding(new Endroid\QrCode\Encoding\Encoding('UTF-8')) ->setSize(300) - ->setPadding(0) - ->setErrorCorrection('high') - // ->setLabel('Scan the code') - // ->setLabelFontSize(16) - ->setForegroundColor(['r' => 0, 'g' => 0, 'b' => 0, 'a' => 0]) - ->setBackgroundColor(['r' => 255, 'g' => 255, 'b' => 255, 'a' => 0]); + ->setMargin(0) + ->setErrorCorrectionLevel(new Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelHigh()) + ->setForegroundColor(new Endroid\QrCode\Color\Color(0, 0, 0)) + ->setBackgroundColor(new Endroid\QrCode\Color\Color(255, 255, 255)); - return $qrCode->get('png'); + $writer = new Endroid\QrCode\Writer\PngWriter(); + $result = $writer->write($qrCode); + return $result->getString(); } }