imagick.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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\Common\EccLevel;
  10. use chillerlan\QRCode\Data\QRMatrix;
  11. use chillerlan\QRCode\Output\QROutputInterface;
  12. require_once __DIR__.'/../vendor/autoload.php';
  13. $options = new QROptions([
  14. 'version' => 7,
  15. 'outputType' => QROutputInterface::IMAGICK,
  16. 'eccLevel' => EccLevel::L,
  17. 'imageBase64' => false,
  18. 'bgColor' => '#ccccaa', // overrides the imageTransparent setting
  19. 'imageTransparent' => true,
  20. 'scale' => 20,
  21. 'drawLightModules' => true,
  22. 'drawCircularModules' => true,
  23. 'circleRadius' => 0.4,
  24. 'keepAsSquare' => [
  25. QRMatrix::M_FINDER_DARK,
  26. QRMatrix::M_FINDER_DOT,
  27. QRMatrix::M_ALIGNMENT_DARK,
  28. ],
  29. 'moduleValues' => [
  30. // finder
  31. QRMatrix::M_FINDER_DARK => '#A71111', // dark (true)
  32. QRMatrix::M_FINDER_DOT => '#A71111', // finder dot, dark (true)
  33. QRMatrix::M_FINDER => '#FFBFBF', // light (false)
  34. // alignment
  35. QRMatrix::M_ALIGNMENT_DARK => '#A70364',
  36. QRMatrix::M_ALIGNMENT => '#FFC9C9',
  37. // timing
  38. QRMatrix::M_TIMING_DARK => '#98005D',
  39. QRMatrix::M_TIMING => '#FFB8E9',
  40. // format
  41. QRMatrix::M_FORMAT_DARK => '#003804',
  42. QRMatrix::M_FORMAT => '#CCFB12',
  43. // version
  44. QRMatrix::M_VERSION_DARK => '#650098',
  45. QRMatrix::M_VERSION => '#E0B8FF',
  46. // data
  47. QRMatrix::M_DATA_DARK => '#4A6000',
  48. QRMatrix::M_DATA => '#ECF9BE',
  49. // darkmodule
  50. QRMatrix::M_DARKMODULE => '#080063',
  51. // separator
  52. QRMatrix::M_SEPARATOR => '#DDDDDD',
  53. // quietzone
  54. QRMatrix::M_QUIETZONE => '#DDDDDD',
  55. ],
  56. ]);
  57. header('Content-type: image/png');
  58. echo (new QRCode($options))->render('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
  59. exit;