Documentation ¶
Index ¶
- func CacheName(class, path string) string
- func IsImage(path string) bool
- func NameFromPath(path string) string
- func ThumbName(class string, size int, path string) string
- type Album
- type Image
- type ImagesByName
- type ImagesByTime
- type Provider
- func (p *Provider) Album(path string, refreshCache bool) (*Album, error)
- func (p *Provider) CachedThumb(cacheName string, size int, src io.ReadSeeker) (io.ReadSeeker, error)
- func (p *Provider) CoverThumb(album *Album, size int) (io.ReadSeeker, error)
- func (p *Provider) ImageContent(path string) (io.ReadSeeker, error)
- func (p *Provider) ImageThumb(path string, size int) (io.ReadSeeker, error)
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NameFromPath ¶
NameFromPath tries to generate a human friendly name from a path
Types ¶
type Album ¶
Album specifies a photo album.
type ImagesByName ¶
type ImagesByName []Image
ImagesByName implements sort.Interface for []Image to do a case insensitive sort by Name.
func (ImagesByName) Len ¶
func (a ImagesByName) Len() int
func (ImagesByName) Less ¶
func (a ImagesByName) Less(i, j int) bool
func (ImagesByName) Swap ¶
func (a ImagesByName) Swap(i, j int)
type ImagesByTime ¶
type ImagesByTime []Image
ImagesByTime implements sort.Interface for []Image to sort by Time, most recent first.
func (ImagesByTime) Len ¶
func (a ImagesByTime) Len() int
func (ImagesByTime) Less ¶
func (a ImagesByTime) Less(i, j int) bool
func (ImagesByTime) Swap ¶
func (a ImagesByTime) Swap(i, j int)
type Provider ¶
type Provider struct { FS http.FileSystem Cache *cache.Cache // ImageCacheEntries limits the number of cached full size images. // This is done to limit the amount of memory consumed, but also puts // an effective limit on the number of images that may be transferred // concurrently. ImageCacheEntries [cachedImages]struct { sync.Mutex Name string } }
Provider is used to fetch Albums and Images from a Backend
func NewProvider ¶
func NewProvider(backend http.FileSystem) *Provider
NewProvider returns an initialized Provider
func (*Provider) Album ¶
Album retrieves a (possibly cached) Album from the backend, or returns an error if it is unable to.
func (*Provider) CachedThumb ¶
func (p *Provider) CachedThumb(cacheName string, size int, src io.ReadSeeker) (io.ReadSeeker, error)
CachedThumb returns a (potentially cached) thumbnail of the supplied source image
func (*Provider) CoverThumb ¶
CoverThumb returns a (potentially cached) thumbnail of the album cover, scaled to the size
func (*Provider) ImageContent ¶
func (p *Provider) ImageContent(path string) (io.ReadSeeker, error)
ImageContent returns an io.ReadSeeker for an image stored in the backend at the given path (that may have been cached). Any attempt to read anything other than an image will result in an error.
func (*Provider) ImageThumb ¶
ImageThumb returns a (potentially cached) thumbnail of the image at the given path, scaled to the size.