image.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. use chillerlan\QRCode\Common\EccLevel;
  13. require_once __DIR__.'/../vendor/autoload.php';
  14. $data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s';
  15. $options = new QROptions([
  16. 'version' => 10,
  17. 'outputType' => QRCode::OUTPUT_IMAGE_PNG,
  18. 'eccLevel' => EccLevel::L,
  19. 'scale' => 5,
  20. 'imageBase64' => false,
  21. 'moduleValues' => [
  22. // finder
  23. 1536 => [0, 63, 255], // dark (true)
  24. 6 => [255, 255, 255], // light (false), white is the transparency color and is enabled by default
  25. 5632 => [241, 28, 163], // finder dot, dark (true)
  26. // alignment
  27. 2560 => [255, 0, 255],
  28. 10 => [255, 255, 255],
  29. // timing
  30. 3072 => [255, 0, 0],
  31. 12 => [255, 255, 255],
  32. // format
  33. 3584 => [67, 99, 84],
  34. 14 => [255, 255, 255],
  35. // version
  36. 4096 => [62, 174, 190],
  37. 16 => [255, 255, 255],
  38. // data
  39. 1024 => [0, 0, 0],
  40. 4 => [255, 255, 255],
  41. // darkmodule
  42. 512 => [0, 0, 0],
  43. // separator
  44. 8 => [255, 255, 255],
  45. // quietzone
  46. 18 => [255, 255, 255],
  47. // logo (requires a call to QRMatrix::setLogoSpace())
  48. 20 => [255, 255, 255],
  49. ],
  50. ]);
  51. header('Content-type: image/png');
  52. echo (new QRCode($options))->render($data);