imagick.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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' => 7,
  13. 'outputType' => QRCode::OUTPUT_IMAGICK,
  14. 'eccLevel' => QRCode::ECC_L,
  15. 'scale' => 5,
  16. 'moduleValues' => [
  17. // finder
  18. (QRMatrix::M_FINDER << 8) => '#A71111', // dark (true)
  19. (QRMatrix::M_FINDER_DOT << 8) => '#A71111',
  20. QRMatrix::M_FINDER => '#FFBFBF', // light (false)
  21. // alignment
  22. (QRMatrix::M_ALIGNMENT << 8) => '#A70364',
  23. QRMatrix::M_ALIGNMENT => '#FFC9C9',
  24. // timing
  25. (QRMatrix::M_TIMING << 8) => '#98005D',
  26. QRMatrix::M_TIMING => '#FFB8E9',
  27. // format
  28. (QRMatrix::M_FORMAT << 8) => '#003804',
  29. QRMatrix::M_FORMAT => '#00FB12',
  30. // version
  31. (QRMatrix::M_VERSION << 8) => '#650098',
  32. QRMatrix::M_VERSION => '#E0B8FF',
  33. // data
  34. (QRMatrix::M_DATA << 8) => '#4A6000',
  35. QRMatrix::M_DATA => '#ECF9BE',
  36. // darkmodule
  37. (QRMatrix::M_DARKMODULE << 8) => '#080063',
  38. // separator
  39. QRMatrix::M_SEPARATOR => '#DDDDDD',
  40. // quietzone
  41. QRMatrix::M_QUIETZONE => '#DDDDDD',
  42. ],
  43. ]);
  44. header('Content-type: image/png');
  45. echo (new QRCode($options))->render('https://www.youtube.com/watch?v=dQw4w9WgXcQ');