Example #1
0
func (r *resourceUser) GenerateAvatar(userId string) error {
	args := map[string]string{}
	gp := geopattern.Generate(args)
	//Create svg file
	f, err := os.Create(config.AvatarPath + userId + ".svg")
	if err != nil {
		return err
	}
	defer f.Close()
	_, err = f.WriteString(gp)
	return err
}
Example #2
0
// Prints pattern's SVG string with a specific background color
func main() {
	args := map[string]string{"color": "#f9b"}
	gp := geopattern.Generate(args)
	fmt.Println(gp)
}
Example #3
0
// Prints pattern's SVG string for a specific pattern
func main() {
	args := map[string]string{"generator": "squares"}
	gp := geopattern.Generate(args)
	fmt.Println(gp)
}
Example #4
0
// Prints pattern's SVG string without any argument
func main() {
	args := map[string]string{}
	gp := geopattern.Generate(args)
	fmt.Println(gp)
}