refactor
This commit is contained in:
@ -65,7 +65,7 @@ func (Contact *ContactCard) WritePng(filename string) {
|
||||
|
||||
}
|
||||
|
||||
func (Contact *ContactCard) WriteQr(FileName string) {
|
||||
func (Contact *ContactCard) WriteQr(filename string) {
|
||||
jsonContact, _ := json.Marshal(Contact)
|
||||
qwriter := qrcode.NewQRCodeWriter()
|
||||
code, err := qwriter.Encode(string(jsonContact), gozxing.BarcodeFormat_QR_CODE, 512, 512, nil)
|
||||
@ -81,8 +81,8 @@ func (Contact *ContactCard) WriteQr(FileName string) {
|
||||
|
||||
}
|
||||
|
||||
func ReadQr(FileName string) ContactCard {
|
||||
var Contact ContactCard
|
||||
func ReadQr(Filename string) ContactCard {
|
||||
var contact ContactCard
|
||||
// open and decode image file
|
||||
file, _ := os.Open("qrcode.jpg")
|
||||
img, _, _ := image.Decode(file)
|
||||
@ -95,5 +95,5 @@ func ReadQr(FileName string) ContactCard {
|
||||
result, _ := qrReader.Decode(bmp, nil)
|
||||
|
||||
fmt.Println(result)
|
||||
return Contact
|
||||
return contact
|
||||
}
|
||||
|
Reference in New Issue
Block a user