Skip to content

Commit

Permalink
update to Endroid\QrCode v4
Browse files Browse the repository at this point in the history
  • Loading branch information
johndoh committed Aug 20, 2021
1 parent b60e618 commit 6194505
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion composer.json-dist
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
18 changes: 9 additions & 9 deletions program/actions/contacts/qrcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

0 comments on commit 6194505

Please sign in to comment.