qrcode

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Qrcode

type Qrcode struct {
	// contains filtered or unexported fields
}

func New

func New(content string, options ...QrcodeOption) *Qrcode

创建二维码实例

  • {content} 二维码内容
  • {options} 可选项, 调用 With* 函数可设置

func (*Qrcode) SaveAsB64Str

func (qr *Qrcode) SaveAsB64Str(withFormatPrefix bool) (str string, err error)

SaveAsB64Str 二维码转为图片 base64 字串

  • {withFormatPrefix} 是否携带图片格式前缀

func (*Qrcode) SaveToFile

func (qr *Qrcode) SaveToFile(imgPath string) (err error)

SaveToFile 二维码存为图片文件

  • {imgPath} 保存文件路径

type QrcodeOption

type QrcodeOption func(qr *Qrcode)

func WithCenterImg

func WithCenterImg(pathOrB64str string, w, h uint) QrcodeOption

配置中心图

  • {pathOrB64str} 中心图路径或Base64字串
  • {w},{h} 中心图宽高,单位/像素

func WithSize

func WithSize(size uint) QrcodeOption

配置二维码大小

  • {size} 尺寸,单位/像素. 默认50px

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL