image.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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' => 5,
  16. 'outputType' => QRCode::OUTPUT_IMAGE_PNG,
  17. 'eccLevel' => QRCode::ECC_L,
  18. 'scale' => 10,
  19. 'imageBase64' => false,
  20. 'moduleValues' => [
  21. // finder
  22. 1536 => [255, 0, 0], // dark (true)
  23. 6 => [255, 255, 255], // light (false), white is the transparency color and is enabled by default
  24. // alignment
  25. 2560 => [255, 0, 0],
  26. 10 => [255, 255, 255],
  27. // timing
  28. 3072 => [0, 0, 0],
  29. 12 => [200, 200, 200],
  30. // format
  31. 3584 => [0, 0, 0],
  32. 14 => [200, 200, 200],
  33. // version
  34. 4096 => [0, 0, 0],
  35. 16 => [200, 200, 200],
  36. // data
  37. 1024 => [0, 0, 150],
  38. 4 => [255, 255, 255],
  39. // darkmodule
  40. 512 => [0, 0, 0],
  41. // separator
  42. 8 => [200, 200, 200],
  43. // quietzone
  44. 18 => [255, 255, 255],
  45. ],
  46. ]);
  47. header('Content-type: image/png');
  48. echo (new QRCode($options))->render($data);