skip2 / go-qrcode

:sparkles: QR Code encoder (Go)
http://go-qrcode.appspot.com
MIT License
2.58k stars 335 forks source link

How to display the generated image directly instead of saving it as a file #22

Closed wuknet closed 4 years ago

wuknet commented 4 years ago

如何直接显示生成的图片,而不是保存成文件 png, err := qrcode.Encode("https://887d.com", qrcode.Medium, 256) 我想把png这个图片用golang直接显示出来,而不是保存成文件来显示,该如何做到,谢谢 I want to show the picture of PNG directly with golang instead of saving it as a file. Thank you.

xiegeo commented 4 years ago

用的是什么前端? What is your front-end?

wuknet commented 4 years ago

用的是什么前端? What is your front-end?

html 显示,网页中显示出来。

skip2 commented 4 years ago

You can embed a QR code image directly in your HTML using a data URI (like < img src='data:image/png;base64, ...' >), see here for an example:

https://gist.github.com/skip2/0306ffc0553d236af03a600f92cefdeb

http://go-qrcode.appspot.com/ also uses a data URI.

wuknet commented 4 years ago

You can embed a QR code image directly in your HTML using a data URI (like < img src='data:image/png;base64, ...' >), see here for an example:

https://gist.github.com/skip2/0306ffc0553d236af03a600f92cefdeb

http://go-qrcode.appspot.com/ also uses a data URI.

Thank you for your success.