Categorygithub.com/eefret/gogravatar
repositorypackage
0.0.0-20181201135945-2163a437cdca
Repository: https://github.com/eefret/gogravatar.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author

# README

Gravatar for Golang

Gravatar is a tiny go library for accessing gravatar.com avatar images.

Usage example

import "github.com/eefret/gravatar"

func main(){
	g, err := gravatar.New() //Creating our object to hold preferences: size, defaultImg, rating
	
	g.URLParse("[email protected]") 
	// prints https://www.gravatar.com/avatar/c82739de14cf64affaf30856ca95b851.jpg?d=&r=g&s=80
	
	g.SetSize(uint(256))
	data, err := g.Download("[email protected]")
	// Returns []byte containing the Image with modified size to 256px
	
	g.SetSize(uint(512))
	g.DownloadToDisk("[email protected]", "/tmp/avatar.jpg")
	// Saves to /tmp our avatar image file with a size of 512
	
	if err != nil {
		log.Fatal(err)
	}
}

License

You can use gravatar under the terms of the Apache v2 license: