imagick.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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' => 7,
  17. 'outputType' => QRCode::OUTPUT_IMAGICK,
  18. 'eccLevel' => EccLevel::L,
  19. 'scale' => 5,
  20. 'moduleValues' => [
  21. // finder
  22. 1536 => '#A71111', // dark (true)
  23. 6 => '#FFBFBF', // light (false)
  24. // alignment
  25. 2560 => '#A70364',
  26. 10 => '#FFC9C9',
  27. // timing
  28. 3072 => '#98005D',
  29. 12 => '#FFB8E9',
  30. // format
  31. 3584 => '#003804',
  32. 14 => '#00FB12',
  33. // version
  34. 4096 => '#650098',
  35. 16 => '#E0B8FF',
  36. // data
  37. 1024 => '#4A6000',
  38. 4 => '#ECF9BE',
  39. // darkmodule
  40. 512 => '#080063',
  41. // separator
  42. 8 => '#DDDDDD',
  43. // quietzone
  44. 18 => '#DDDDDD',
  45. ],
  46. ]);
  47. header('Content-type: image/png');
  48. echo (new QRCode($options))->render($data);