home to your local SPACEGIRL 馃挮 arimelody.space
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 52 lines 1.3 kB view raw
1package controller 2 3import ( 4 "encoding/base64" 5 // "image" 6 // "image/color" 7 8 "github.com/skip2/go-qrcode" 9) 10 11func GenerateQRCode(data string) (string, error) { 12 imgBytes, err := qrcode.Encode(data, qrcode.Medium, 256) 13 if err != nil { 14 return "", err 15 } 16 base64Img := base64.StdEncoding.EncodeToString(imgBytes) 17 return base64Img, nil 18} 19 20// vvv DEPRECATED vvv 21// const margin = 4 22// 23// type QRCodeECCLevel int64 24// const ( 25// LOW QRCodeECCLevel = iota 26// MEDIUM 27// QUARTILE 28// HIGH 29// ) 30// 31// func drawLargeAlignmentSquare(x int, y int, img *image.Gray) { 32// for yi := range 7 { 33// for xi := range 7 { 34// if (xi == 0 || xi == 6) || (yi == 0 || yi == 6) { 35// img.Set(x + xi, y + yi, color.Black) 36// } else if (xi > 1 && xi < 5) && (yi > 1 && yi < 5) { 37// img.Set(x + xi, y + yi, color.Black) 38// } 39// } 40// } 41// } 42// 43// func drawSmallAlignmentSquare(x int, y int, img *image.Gray) { 44// for yi := range 5 { 45// for xi := range 5 { 46// if (xi == 0 || xi == 4) || (yi == 0 || yi == 4) { 47// img.Set(x + xi, y + yi, color.Black) 48// } 49// } 50// } 51// img.Set(x + 2, y + 2, color.Black) 52// }