Skip to content

qwxingzhe/go-image-local

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-image-local

Godoc Build Status GitHub release MIT License Commit activity Average time to resolve an issue Percentage of issues still open

go-image-local 是一个用go开发的将指定文本中的图片本地化的包。其可配置将图片本地化或者上传到对象存储(对象存储使用的是qwxingzhe/go-object-storage包),可轻易的集成到go项目中,欢迎使用。

安装

$ go get -u github.com/qwxingzhe/go-image-local

使用指南

配置本地存储引擎

localDrives := drives.FileDrives{
	BasePath: "./storage/",
}


配置对象存储引擎(七牛云kodo)

参数配置可参看 qwxingzhe/go-object-storage

localDrives := drives.KodoDrives{
	ObjectStorageDrive: &ObjectStorage.ObjectStorage{
		Drive: ObjectStorageDrives.Kodo{
			AccessKey: kodoConfig.AccessKey,
			SecretKey: kodoConfig.SecretKey,
			Bucket:    kodoConfig.Bucket,
		},
		IsAutomaticProductionPath: true,
		FilePathPrefix:            "test2/",
		IsAppendExt:               false,
		BaseUrl:                   "http://qynr9haq9.hd-bkt.clouddn.com/",
	},
}

调用

content := "<img src=\"https://img-home.csdnimg.cn/images/20210827090533.png\">XXX<img  src=\"https://img-blog.csdnimg.cn/606d5fec02674021be47ea0358417e46.jpg?x-oss-process=image/resize,m_fixed,h_200\">"
content = ImageToLocal(localDrives, content)
fmt.Println(content)

Enjoy it! ❤️

License

MIT

About

go版的远程图片本地化

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages