avatar

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2014 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Overview

It is recommend to use this way

cacheDir := "./cache"
defaultImg := "./default.jpg"
http.Handle("/avatar/", avatar.CacheServer(cacheDir, defaultImg))

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheServer

func CacheServer(cacheDir string, defaultImgPath string) http.Handler

http.Handle("/avatar/", avatar.CacheServer("./cache"))

func HashEmail

func HashEmail(email string) string

hash email to md5 string keep this func in order to make this package indenpent

Types

type Avatar

type Avatar struct {
	Hash       string
	AlterImage string // image path
	// contains filtered or unexported fields
}

Avatar represents the avatar object.

func New

func New(hash string, cacheDir string) *Avatar

func (*Avatar) Encode

func (this *Avatar) Encode(wr io.Writer, size int) (err error)

default image format: jpeg

func (*Avatar) Expired

func (this *Avatar) Expired() bool

func (*Avatar) HasCache

func (this *Avatar) HasCache() bool

func (*Avatar) Modtime

func (this *Avatar) Modtime() (modtime time.Time, err error)

func (*Avatar) Update

func (this *Avatar) Update()

get image from gravatar.com

func (*Avatar) UpdateTimeout

func (this *Avatar) UpdateTimeout(timeout time.Duration) (err error)

type Thunder

type Thunder struct {
	QueueSize int // download queue size
	// contains filtered or unexported fields
}

func (*Thunder) Fetch

func (t *Thunder) Fetch(url string, saveFile string) error

func (*Thunder) GoFetch

func (t *Thunder) GoFetch(url, saveFile string) chan error

Jump to

Keyboard shortcuts

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