PHP - Generating dynamic Qrcode customized with PHP

Asked

Viewed 932 times

1

I am trying to generate Qrcode with dynamic information with the library Phpqrcode, Qrcode I’ve been able to generate in SVG, but I’m not being able to style it to have rounded edges and the company logo in the middle, more or less like this example. Does anyone have any idea how to do this with this library? I have tried using border-radius of the CSS in use but it didn’t work out.

Follows the codes:

$nome_do_arquivo   = "phpqrcode/temp/svg.svg";
$link = "google.com";
$svgCode = QRcode::svg(
  $link, // conteudo do qrcode
  $nome_do_arquivo, // caminho do arquivo com nome
  false, // save
  QR_ECLEVEL_H, // qualidade do qrcode
  false // tamanho do qrcode
);
// assim ele retorna os codigos do SVG
echo file_get_contents($nome_do_arquivo);

And here the SVG:

<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" baseProfile="full"  width="232" height="232" viewBox="0 0 232 232"
		 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events">
<desc></desc>
<rect width="232" height="232" fill="#ffffff" cx="0" cy="0" />
<defs>
<rect id="p" width="8" height="8" />
</defs>
<g fill="#000000">
<use x="32" y="32" xlink:href="#p" />
<use x="32" y="40" xlink:href="#p" />
<use x="32" y="48" xlink:href="#p" />
<use x="32" y="56" xlink:href="#p" />
<use x="32" y="64" xlink:href="#p" />
<use x="32" y="72" xlink:href="#p" />
<use x="32" y="80" xlink:href="#p" />
<use x="32" y="96" xlink:href="#p" />
<use x="32" y="112" xlink:href="#p" />
<use x="32" y="120" xlink:href="#p" />
<use x="32" y="128" xlink:href="#p" />
<use x="32" y="144" xlink:href="#p" />
<use x="32" y="152" xlink:href="#p" />
<use x="32" y="160" xlink:href="#p" />
<use x="32" y="168" xlink:href="#p" />
<use x="32" y="176" xlink:href="#p" />
<use x="32" y="184" xlink:href="#p" />
<use x="32" y="192" xlink:href="#p" />
<use x="40" y="32" xlink:href="#p" />
<use x="40" y="80" xlink:href="#p" />
<use x="40" y="96" xlink:href="#p" />
<use x="40" y="112" xlink:href="#p" />
<use x="40" y="120" xlink:href="#p" />
<use x="40" y="128" xlink:href="#p" />
<use x="40" y="144" xlink:href="#p" />
<use x="40" y="192" xlink:href="#p" />
<use x="48" y="32" xlink:href="#p" />
<use x="48" y="48" xlink:href="#p" />
<use x="48" y="56" xlink:href="#p" />
<use x="48" y="64" xlink:href="#p" />
<use x="48" y="80" xlink:href="#p" />
<use x="48" y="96" xlink:href="#p" />
<use x="48" y="104" xlink:href="#p" />
<use x="48" y="120" xlink:href="#p" />
<use x="48" y="144" xlink:href="#p" />
<use x="48" y="160" xlink:href="#p" />
<use x="48" y="168" xlink:href="#p" />
<use x="48" y="176" xlink:href="#p" />
<use x="48" y="192" xlink:href="#p" />
<use x="56" y="32" xlink:href="#p" />
<use x="56" y="48" xlink:href="#p" />
<use x="56" y="56" xlink:href="#p" />
<use x="56" y="64" xlink:href="#p" />
<use x="56" y="80" xlink:href="#p" />
<use x="56" y="96" xlink:href="#p" />
<use x="56" y="104" xlink:href="#p" />
<use x="56" y="120" xlink:href="#p" />
<use x="56" y="128" xlink:href="#p" />
<use x="56" y="144" xlink:href="#p" />
<use x="56" y="160" xlink:href="#p" />
<use x="56" y="168" xlink:href="#p" />
<use x="56" y="176" xlink:href="#p" />
<use x="56" y="192" xlink:href="#p" />
<use x="64" y="32" xlink:href="#p" />
<use x="64" y="48" xlink:href="#p" />
<use x="64" y="56" xlink:href="#p" />
<use x="64" y="64" xlink:href="#p" />
<use x="64" y="80" xlink:href="#p" />
<use x="64" y="96" xlink:href="#p" />
<use x="64" y="112" xlink:href="#p" />
<use x="64" y="144" xlink:href="#p" />
<use x="64" y="160" xlink:href="#p" />
<use x="64" y="168" xlink:href="#p" />
<use x="64" y="176" xlink:href="#p" />
<use x="64" y="192" xlink:href="#p" />
<use x="72" y="32" xlink:href="#p" />
<use x="72" y="80" xlink:href="#p" />
<use x="72" y="104" xlink:href="#p" />
<use x="72" y="112" xlink:href="#p" />
<use x="72" y="120" xlink:href="#p" />
<use x="72" y="128" xlink:href="#p" />
<use x="72" y="144" xlink:href="#p" />
<use x="72" y="192" xlink:href="#p" />
<use x="80" y="32" xlink:href="#p" />
<use x="80" y="40" xlink:href="#p" />
<use x="80" y="48" xlink:href="#p" />
<use x="80" y="56" xlink:href="#p" />
<use x="80" y="64" xlink:href="#p" />
<use x="80" y="72" xlink:href="#p" />
<use x="80" y="80" xlink:href="#p" />
<use x="80" y="96" xlink:href="#p" />
<use x="80" y="112" xlink:href="#p" />
<use x="80" y="128" xlink:href="#p" />
<use x="80" y="144" xlink:href="#p" />
<use x="80" y="152" xlink:href="#p" />
<use x="80" y="160" xlink:href="#p" />
<use x="80" y="168" xlink:href="#p" />
<use x="80" y="176" xlink:href="#p" />
<use x="80" y="184" xlink:href="#p" />
<use x="80" y="192" xlink:href="#p" />
<use x="88" y="96" xlink:href="#p" />
<use x="88" y="120" xlink:href="#p" />
<use x="88" y="128" xlink:href="#p" />
<use x="96" y="40" xlink:href="#p" />
<use x="96" y="56" xlink:href="#p" />
<use x="96" y="72" xlink:href="#p" />
<use x="96" y="80" xlink:href="#p" />
<use x="96" y="96" xlink:href="#p" />
<use x="96" y="112" xlink:href="#p" />
<use x="96" y="120" xlink:href="#p" />
<use x="96" y="136" xlink:href="#p" />
<use x="96" y="144" xlink:href="#p" />
<use x="96" y="160" xlink:href="#p" />
<use x="96" y="168" xlink:href="#p" />
<use x="96" y="176" xlink:href="#p" />
<use x="96" y="184" xlink:href="#p" />
<use x="96" y="192" xlink:href="#p" />
<use x="104" y="40" xlink:href="#p" />
<use x="104" y="56" xlink:href="#p" />
<use x="104" y="64" xlink:href="#p" />
<use x="104" y="88" xlink:href="#p" />
<use x="104" y="104" xlink:href="#p" />
<use x="104" y="128" xlink:href="#p" />
<use x="104" y="136" xlink:href="#p" />
<use x="104" y="144" xlink:href="#p" />
<use x="104" y="152" xlink:href="#p" />
<use x="104" y="160" xlink:href="#p" />
<use x="104" y="168" xlink:href="#p" />
<use x="104" y="176" xlink:href="#p" />
<use x="104" y="192" xlink:href="#p" />
<use x="112" y="32" xlink:href="#p" />
<use x="112" y="40" xlink:href="#p" />
<use x="112" y="48" xlink:href="#p" />
<use x="112" y="80" xlink:href="#p" />
<use x="112" y="104" xlink:href="#p" />
<use x="112" y="112" xlink:href="#p" />
<use x="112" y="128" xlink:href="#p" />
<use x="112" y="136" xlink:href="#p" />
<use x="112" y="144" xlink:href="#p" />
<use x="112" y="176" xlink:href="#p" />
<use x="112" y="184" xlink:href="#p" />
<use x="120" y="32" xlink:href="#p" />
<use x="120" y="48" xlink:href="#p" />
<use x="120" y="72" xlink:href="#p" />
<use x="120" y="96" xlink:href="#p" />
<use x="120" y="104" xlink:href="#p" />
<use x="120" y="120" xlink:href="#p" />
<use x="120" y="144" xlink:href="#p" />
<use x="120" y="160" xlink:href="#p" />
<use x="120" y="168" xlink:href="#p" />
<use x="120" y="184" xlink:href="#p" />
<use x="128" y="32" xlink:href="#p" />
<use x="128" y="40" xlink:href="#p" />
<use x="128" y="48" xlink:href="#p" />
<use x="128" y="56" xlink:href="#p" />
<use x="128" y="64" xlink:href="#p" />
<use x="128" y="80" xlink:href="#p" />
<use x="128" y="104" xlink:href="#p" />
<use x="128" y="112" xlink:href="#p" />
<use x="128" y="120" xlink:href="#p" />
<use x="128" y="128" xlink:href="#p" />
<use x="128" y="136" xlink:href="#p" />
<use x="128" y="168" xlink:href="#p" />
<use x="128" y="176" xlink:href="#p" />
<use x="128" y="184" xlink:href="#p" />
<use x="128" y="192" xlink:href="#p" />
<use x="136" y="96" xlink:href="#p" />
<use x="136" y="104" xlink:href="#p" />
<use x="136" y="120" xlink:href="#p" />
<use x="136" y="144" xlink:href="#p" />
<use x="136" y="160" xlink:href="#p" />
<use x="136" y="168" xlink:href="#p" />
<use x="136" y="184" xlink:href="#p" />
<use x="144" y="32" xlink:href="#p" />
<use x="144" y="40" xlink:href="#p" />
<use x="144" y="48" xlink:href="#p" />
<use x="144" y="56" xlink:href="#p" />
<use x="144" y="64" xlink:href="#p" />
<use x="144" y="72" xlink:href="#p" />
<use x="144" y="80" xlink:href="#p" />
<use x="144" y="104" xlink:href="#p" />
<use x="144" y="112" xlink:href="#p" />
<use x="144" y="120" xlink:href="#p" />
<use x="144" y="168" xlink:href="#p" />
<use x="144" y="176" xlink:href="#p" />
<use x="144" y="184" xlink:href="#p" />
<use x="152" y="32" xlink:href="#p" />
<use x="152" y="80" xlink:href="#p" />
<use x="152" y="96" xlink:href="#p" />
<use x="152" y="112" xlink:href="#p" />
<use x="152" y="128" xlink:href="#p" />
<use x="152" y="136" xlink:href="#p" />
<use x="152" y="152" xlink:href="#p" />
<use x="152" y="176" xlink:href="#p" />
<use x="152" y="192" xlink:href="#p" />
<use x="160" y="32" xlink:href="#p" />
<use x="160" y="48" xlink:href="#p" />
<use x="160" y="56" xlink:href="#p" />
<use x="160" y="64" xlink:href="#p" />
<use x="160" y="80" xlink:href="#p" />
<use x="160" y="144" xlink:href="#p" />
<use x="160" y="152" xlink:href="#p" />
<use x="160" y="160" xlink:href="#p" />
<use x="168" y="32" xlink:href="#p" />
<use x="168" y="48" xlink:href="#p" />
<use x="168" y="56" xlink:href="#p" />
<use x="168" y="64" xlink:href="#p" />
<use x="168" y="80" xlink:href="#p" />
<use x="168" y="96" xlink:href="#p" />
<use x="168" y="120" xlink:href="#p" />
<use x="168" y="144" xlink:href="#p" />
<use x="168" y="168" xlink:href="#p" />
<use x="168" y="184" xlink:href="#p" />
<use x="176" y="32" xlink:href="#p" />
<use x="176" y="48" xlink:href="#p" />
<use x="176" y="56" xlink:href="#p" />
<use x="176" y="64" xlink:href="#p" />
<use x="176" y="80" xlink:href="#p" />
<use x="176" y="104" xlink:href="#p" />
<use x="176" y="120" xlink:href="#p" />
<use x="176" y="136" xlink:href="#p" />
<use x="176" y="152" xlink:href="#p" />
<use x="176" y="160" xlink:href="#p" />
<use x="176" y="192" xlink:href="#p" />
<use x="184" y="32" xlink:href="#p" />
<use x="184" y="80" xlink:href="#p" />
<use x="184" y="96" xlink:href="#p" />
<use x="184" y="112" xlink:href="#p" />
<use x="184" y="120" xlink:href="#p" />
<use x="184" y="144" xlink:href="#p" />
<use x="184" y="152" xlink:href="#p" />
<use x="184" y="192" xlink:href="#p" />
<use x="192" y="32" xlink:href="#p" />
<use x="192" y="40" xlink:href="#p" />
<use x="192" y="48" xlink:href="#p" />
<use x="192" y="56" xlink:href="#p" />
<use x="192" y="64" xlink:href="#p" />
<use x="192" y="72" xlink:href="#p" />
<use x="192" y="80" xlink:href="#p" />
<use x="192" y="104" xlink:href="#p" />
<use x="192" y="136" xlink:href="#p" />
<use x="192" y="152" xlink:href="#p" />
</g>
</svg>

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.