fix
This commit is contained in:
parent
f1d20d061c
commit
50bca808f1
|
@ -31,7 +31,10 @@ func CreateQrCodeBs64WithLogo(content, outPath string, logoPath string, size, x,
|
||||||
if x != 0 || y != 0 {
|
if x != 0 || y != 0 {
|
||||||
draw.Draw(outImg, outImg.Bounds().Add(image.Pt(x, y)), qrcodeImg, outImg.Bounds().Min, draw.Src)
|
draw.Draw(outImg, outImg.Bounds().Add(image.Pt(x, y)), qrcodeImg, outImg.Bounds().Min, draw.Src)
|
||||||
}
|
}
|
||||||
_ = png.Encode(buf, outImg)
|
err = png.Encode(buf, outImg)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
if outPath != "" {
|
if outPath != "" {
|
||||||
// 写入文件
|
// 写入文件
|
||||||
f, err := os.Create(outPath)
|
f, err := os.Create(outPath)
|
||||||
|
@ -85,9 +88,15 @@ func CreateQrCodeBs64WithLogo(content, outPath string, logoPath string, size, x,
|
||||||
}
|
}
|
||||||
if outPath != "" {
|
if outPath != "" {
|
||||||
// 写入文件
|
// 写入文件
|
||||||
f, _ := os.Create(outPath)
|
f, err := os.Create(outPath)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
_ = png.Encode(f, outImg)
|
err = png.Encode(f, outImg)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return base64.StdEncoding.EncodeToString(buf.Bytes()), nil
|
return base64.StdEncoding.EncodeToString(buf.Bytes()), nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user