image.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. *
  4. * @filesource image.php
  5. * @created 24.12.2017
  6. * @author Smiley <smiley@chillerlan.net>
  7. * @copyright 2017 Smiley
  8. * @license MIT
  9. */
  10. namespace chillerlan\QRCodeExamples;
  11. use chillerlan\QRCode\{QRCode, QROptions};
  12. require_once __DIR__.'/../vendor/autoload.php';
  13. $data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s';
  14. $options = new QROptions([
  15. 'version' => 10,
  16. 'outputType' => QRCode::OUTPUT_IMAGE_PNG,
  17. 'eccLevel' => QRCode::ECC_H,
  18. 'scale' => 5,
  19. 'imageBase64' => false,
  20. 'moduleValues' => [
  21. // finder
  22. 1536 => [0, 63, 255], // dark (true)
  23. 6 => [255, 255, 255], // light (false), white is the transparency color and is enabled by default
  24. 5632 => [241, 28, 163], // finder dot, dark (true)
  25. // alignment
  26. 2560 => [255, 0, 255],
  27. 10 => [255, 255, 255],
  28. // timing
  29. 3072 => [255, 0, 0],
  30. 12 => [255, 255, 255],
  31. // format
  32. 3584 => [67, 99, 84],
  33. 14 => [255, 255, 255],
  34. // version
  35. 4096 => [62, 174, 190],
  36. 16 => [255, 255, 255],
  37. // data
  38. 1024 => [0, 0, 0],
  39. 4 => [255, 255, 255],
  40. // darkmodule
  41. 512 => [0, 0, 0],
  42. // separator
  43. 8 => [255, 255, 255],
  44. // quietzone
  45. 18 => [255, 255, 255],
  46. // logo
  47. 20 => [255, 255, 255],
  48. ],
  49. ]);
  50. header('Content-type: image/png');
  51. echo (new QRCode($options))->render($data);