mirror of
https://github.com/lnbits/lnbits.git
synced 2025-07-08 22:40:35 +02:00
Image loading as SVG
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
from quart import g, abort, render_template
|
from quart import g, abort, render_template
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import pyqrcode
|
import pyqrcode
|
||||||
import png
|
from io import BytesIO
|
||||||
from lnbits.decorators import check_user_exists, validate_uuids
|
from lnbits.decorators import check_user_exists, validate_uuids
|
||||||
|
|
||||||
from . import withdraw_ext
|
from . import withdraw_ext
|
||||||
@ -27,9 +27,13 @@ async def img(link_id):
|
|||||||
print(link)
|
print(link)
|
||||||
qr = pyqrcode.create(link.lnurl)
|
qr = pyqrcode.create(link.lnurl)
|
||||||
print(qr)
|
print(qr)
|
||||||
qrimage = qr.png('qrimage.png', scale=5)
|
stream = BytesIO()
|
||||||
print(qrimage)
|
qr.svg(stream, scale=3)
|
||||||
return qrimage
|
return stream.getvalue(), 200, {
|
||||||
|
'Content-Type': 'image/svg+xml',
|
||||||
|
'Cache-Control': 'no-cache, no-store, must-revalidate',
|
||||||
|
'Pragma': 'no-cache',
|
||||||
|
'Expires': '0'}
|
||||||
|
|
||||||
@withdraw_ext.route("/print/<link_id>")
|
@withdraw_ext.route("/print/<link_id>")
|
||||||
async def print_qr(link_id):
|
async def print_qr(link_id):
|
||||||
|
Reference in New Issue
Block a user