imagick.php 1.9 KB

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