imagick.php 2.1 KB

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