baconqrprovider.php 598 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace Grav\Plugin\Admin;
  3. use BaconQrCode\Renderer\Image\Png as BaconPng;
  4. use BaconQrCode\Writer as BaconWriter;
  5. use RobThree\Auth\Providers\Qr\IQRCodeProvider;
  6. class BaconQRProvider implements IQRCodeProvider
  7. {
  8. public function getMimeType()
  9. {
  10. return 'image/png';
  11. }
  12. public function getQRCodeImage($qrtext, $size = 256)
  13. {
  14. $renderer = new BaconPng();
  15. $renderer->setHeight($size);
  16. $renderer->setWidth($size);
  17. $writer = new BaconWriter($renderer);
  18. $result = $writer->writeString($qrtext);
  19. return $result;
  20. }
  21. }