html.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. /**
  3. * @created 21.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 '../vendor/autoload.php';
  13. header('Content-Type: text/html; charset=utf-8');
  14. $options = new QROptions([
  15. 'version' => 5,
  16. 'outputType' => QROutputInterface::MARKUP_HTML,
  17. 'eccLevel' => EccLevel::L,
  18. 'cssClass' => 'qrcode',
  19. 'moduleValues' => [
  20. // finder
  21. QRMatrix::M_FINDER_DARK => '#A71111', // dark (true)
  22. QRMatrix::M_FINDER_DOT => '#A71111', // finder dot, dark (true)
  23. QRMatrix::M_FINDER => '#FFBFBF', // light (false)
  24. // alignment
  25. QRMatrix::M_ALIGNMENT_DARK => '#A70364',
  26. QRMatrix::M_ALIGNMENT => '#FFC9C9',
  27. // timing
  28. QRMatrix::M_TIMING_DARK => '#98005D',
  29. QRMatrix::M_TIMING => '#FFB8E9',
  30. // format
  31. QRMatrix::M_FORMAT_DARK => '#003804',
  32. QRMatrix::M_FORMAT => '#00FB12',
  33. // version
  34. QRMatrix::M_VERSION_DARK => '#650098',
  35. QRMatrix::M_VERSION => '#E0B8FF',
  36. // data
  37. QRMatrix::M_DATA_DARK => '#4A6000',
  38. QRMatrix::M_DATA => '#ECF9BE',
  39. // darkmodule
  40. QRMatrix::M_DARKMODULE => '#080063',
  41. // separator
  42. QRMatrix::M_SEPARATOR => '#AFBFBF',
  43. // quietzone
  44. QRMatrix::M_QUIETZONE => '#DDDDDD',
  45. ],
  46. ]);
  47. ?>
  48. <!DOCTYPE html>
  49. <html lang="en">
  50. <head>
  51. <meta charset="UTF-8"/>
  52. <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  53. <title>QRCode test</title>
  54. <style>
  55. div.qrcode{
  56. margin: 1em;
  57. }
  58. /* rows */
  59. div.qrcode > div {
  60. height: 10px;
  61. }
  62. /* modules */
  63. div.qrcode > div > span {
  64. display: inline-block;
  65. width: 10px;
  66. height: 10px;
  67. }
  68. </style>
  69. </head>
  70. <body>
  71. <?php
  72. echo (new QRCode($options))->render('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
  73. ?>
  74. </body>
  75. </html>