reader.php 675 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. * reader.php
  4. *
  5. * @created 25.04.2022
  6. * @author smiley <smiley@chillerlan.net>
  7. * @copyright 2022 smiley
  8. * @license MIT
  9. */
  10. use chillerlan\QRCode\{QRCode, QROptions};
  11. require_once __DIR__.'/../vendor/autoload.php';
  12. // please excuse the IDE yelling https://youtrack.jetbrains.com/issue/WI-66549
  13. $options = new QROptions;
  14. $options->readerUseImagickIfAvailable = false;
  15. $options->readerGrayscale = true;
  16. $options->readerIncreaseContrast = true;
  17. try{
  18. $result = (new QRCode($options))->readFromFile(__DIR__.'/../.github/images/example_image.png');
  19. var_dump($result);
  20. }
  21. catch(Throwable $e){
  22. echo $e->getMessage();
  23. }
  24. exit;