Documentation ¶
Index ¶
- func ConvertImageType(src, dest string) error
- func DecodeFromBase64(base64 []byte) ([]byte, error)
- func DecodeToImageFile(base64 []byte, dest string) error
- func EncodeToBase64String(data []byte) (string, error)
- func GetBase64OfImage(imagePath string) (string, error)
- func GetBase64OfWebImage(url string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertImageType ¶
ConvertImageType 图片格式转换(图片类型转换)
@param src 源图片路径(如果文件不存在,会报error) @param dest 目标图片路径(如果文件已存在,会覆盖,覆盖不了就报error)
PS: (1) src和dest的图片格式可以是一样的,此种情况类似于复制; (2) 支持的图片格式:"jpg"、"jpeg"、"png"、"gif"、"tif"、"tiff"、"bmp".(详见 imaging.Save())
func DecodeFromBase64 ¶
DecodeFromBase64 图片的base64数据 => 图片的数据(可以直接存储到硬盘上)
@param base64 带不带前缀都无所谓(e.g. "data:image/png;base64,"、"data:image/jpeg;base64,"、"data:image/gif;base64,")
func EncodeToBase64String ¶
func GetBase64OfImage ¶
GetBase64OfImage (硬盘上的)图片 => base64字符串
参考: golang 将图片生成Base64 https://blog.csdn.net/weixin_40292098/article/details/126029489
func GetBase64OfWebImage ¶
GetBase64OfWebImage 网络图片 => base64字符串
参考: golang 将图片生成Base64 https://blog.csdn.net/weixin_40292098/article/details/126029489
@param url e.g."https://img.redocn.com/sheying/20150507/pugongying_4267498.jpg"
Types ¶
This section is empty.