mirror of https://github.com/certusone/dc4bc.git
feat: added QR code functionality
This commit is contained in:
parent
2833f5b317
commit
289b0d3ac5
|
@ -5,6 +5,7 @@ import (
|
|||
_ "image/gif"
|
||||
_ "image/jpeg"
|
||||
_ "image/png"
|
||||
"os"
|
||||
|
||||
"github.com/mattn/go-gtk/glib"
|
||||
"github.com/mattn/go-gtk/gtk"
|
||||
|
@ -18,6 +19,10 @@ import (
|
|||
const tmpImageFile = "/tmp/qr.png"
|
||||
|
||||
func ShowQR(data string) error {
|
||||
defer func() {
|
||||
_ = os.Remove(tmpImageFile)
|
||||
}()
|
||||
|
||||
err := encoder.WriteFile(data, encoder.Medium, 512, tmpImageFile)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to encode the data: %w", err)
|
||||
|
|
Loading…
Reference in New Issue