image.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * @created 24.12.2017
  4. * @author Smiley <smiley@chillerlan.net>
  5. * @copyright 2017 Smiley
  6. * @license MIT
  7. */
  8. use chillerlan\QRCode\{QRCode, QROptions};
  9. use chillerlan\QRCode\Data\QRMatrix;
  10. require_once __DIR__.'/../vendor/autoload.php';
  11. $options = new QROptions([
  12. 'version' => 10,
  13. 'outputType' => QRCode::OUTPUT_IMAGE_PNG,
  14. 'eccLevel' => QRCode::ECC_H,
  15. 'scale' => 5,
  16. 'imageBase64' => false,
  17. 'moduleValues' => [
  18. // finder
  19. (QRMatrix::M_FINDER << 8) => [0, 63, 255], // dark (true)
  20. (QRMatrix::M_FINDER_DOT << 8) => [241, 28, 163], // finder dot, dark (true)
  21. QRMatrix::M_FINDER => [255, 255, 255], // light (false), white is the transparency color and is enabled by default
  22. // alignment
  23. (QRMatrix::M_ALIGNMENT << 8) => [255, 0, 255],
  24. QRMatrix::M_ALIGNMENT => [255, 255, 255],
  25. // timing
  26. (QRMatrix::M_TIMING << 8) => [255, 0, 0],
  27. QRMatrix::M_TIMING => [255, 255, 255],
  28. // format
  29. (QRMatrix::M_FORMAT << 8) => [67, 99, 84],
  30. QRMatrix::M_FORMAT => [255, 255, 255],
  31. // version
  32. (QRMatrix::M_VERSION << 8) => [62, 174, 190],
  33. QRMatrix::M_VERSION => [255, 255, 255],
  34. // data
  35. (QRMatrix::M_DATA << 8) => [0, 0, 0],
  36. QRMatrix::M_DATA => [255, 255, 255],
  37. // darkmodule
  38. (QRMatrix::M_DARKMODULE << 8) => [0, 0, 0],
  39. // separator
  40. QRMatrix::M_SEPARATOR => [255, 255, 255],
  41. // quietzone
  42. QRMatrix::M_QUIETZONE => [255, 255, 255],
  43. // logo (requires a call to QRMatrix::setLogoSpace())
  44. QRMatrix::M_LOGO => [255, 255, 255],
  45. ],
  46. ]);
  47. header('Content-type: image/png');
  48. echo (new QRCode($options))->render('https://www.youtube.com/watch?v=dQw4w9WgXcQ');