* @copyright 2023 smiley * @license MIT */ use chillerlan\QRCode\Data\QRMatrix; use chillerlan\QRCode\Output\QROutputInterface; use chillerlan\QRCode\QRCode; use chillerlan\QRCode\QROptions; require_once __DIR__.'/../vendor/autoload.php'; $options = new QROptions; $options->version = 7; $options->outputType = QROutputInterface::MARKUP_SVG; $options->outputBase64 = false; $options->svgAddXmlHeader = false; $options->drawLightModules = false; $options->markupDark = ''; $options->markupLight = ''; $options->drawCircularModules = true; $options->circleRadius = 0.4; $options->connectPaths = true; $options->keepAsSquare = [ QRMatrix::M_FINDER_DARK, QRMatrix::M_FINDER_DOT, QRMatrix::M_ALIGNMENT_DARK, ]; $options->svgDefs = ' '; $qrcode = (new QRCode($options))->addByteSegment('https://www.youtube.com/watch?v=dQw4w9WgXcQ'); // render the SVG $svg_raw = $qrcode->render(); // switch to base64 output $options->outputBase64 = true; // render base64 $svg_base64 = $qrcode->render(); // dump the output header('Content-type: text/html'); ?> QRCode javascript canvas conversion example