So I want to make a QR code dynamically by feeding it a URL in my TWIG template in Symfony. I have the endroid/QrCode bundle installed and seems to be fine, but I'm not sure how to get TWIG to create a QR code image!
So from the GitHub page, all it says for TWIG is:
Twig extension
The bundle provides a Twig extension for generating a QR code URL, path or data URI. You can use the second argument of any of these functions to override any defaults defined by the bundle or set via your configuration.
<img src="{{ qrcode_path(message) }}" />
<img src="{{ qrcode_url(message, { writer: 'eps' }) }}" />
<img src="{{ qrcode_data_uri(message, { writer: 'svg', size: 150 }) }}" />
So I figured for a test, the easiest thing to do would be something like:
<img src="{{ qrcode_url('http://www.test.com') }}" />
However, this brings up the error:
An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "endroid_qrcode_generate" as such route does not exist.").
Anyone got the TWIG extension for this working?
Symfony
right? – DarkBeeqrcode_ur
is aTwig_Function
and can be found under QrCode/src/Twig/Extension/QrCodeExtension.php btw) – DarkBee