html.php 2.2 KB

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