qr-code-bundle
qr-code-bundle copied to clipboard
Twig: Specify `width` and `height` of the generated QR code
It would be nice to be able to fill the width and height attribute of the <img>.
Still remembering the discussion at https://github.com/endroid/qr-code/issues/95: Am I right that when setting size: 137 in config/packages/endroid_qr_code.yaml, I can't be sure that the resulting QR code will have exactly 137 width and height?
If so, then I'd suggest to find a way to pass the actual size to the user. I even had an idea how this could look like: Create a function qr_code_object() that works like this:
{% set qr_code = qr_code_object(...) %}
<img src="{{ qr_code.dataUri }}" width="{{ qr_code.width }}" height="{{ qr_code.height }}">