Versions in this module Expand all Collapse all v0 v0.1.1 Sep 2, 2026 Changes in this version type Options + ForceRecompress bool v0.1.0 Sep 2, 2026 Changes in this version + const DefaultMaxEdge + const DefaultQuality + const DefaultThumbQuality + var ErrOutsideRoot = errors.New("photo: path outside the store root") + var ErrTooLarge = errors.New("photo: image is larger than the limit") + var ErrUnsupportedType = errors.New("photo: unsupported image type") + func DetectContentType(raw []byte, filename string) string + func ExtensionFor(contentType string) string + func Fit(img image.Image, edge int) image.Image + func LooksLikeImage(b []byte) bool + type Image struct + ContentType string + Data []byte + Height int + OriginalBytes int64 + Recompressed bool + SHA256 string + Thumb []byte + ThumbHeight int + ThumbWidth int + Width int + func Process(raw []byte, filename string, opt Options) (*Image, error) + func (i *Image) Bytes() int64 + func (i *Image) Extension() string + func (i *Image) Saved() float64 + type Namer func(*Image) string + func ContentAddressed(dir string) Namer + func Dated(dir, kind string) Namer + type Options struct + KeepUnsupported bool + MaxBytes int64 + MaxEdge int + Quality int + ThumbEdge int + ThumbQuality int + type Saved struct + RelPath string + ThumbPath string + type Store struct + func NewStore(dir string, opt Options) (*Store, error) + func (s *Store) Open(rel string) (*os.File, error) + func (s *Store) Options() Options + func (s *Store) Path(rel string) (string, error) + func (s *Store) Remove(paths ...string) error + func (s *Store) RemoveWithThumb(rel string) error + func (s *Store) Root() string + func (s *Store) Save(r io.Reader, filename string, namer Namer) (*Saved, error) + func (s *Store) SaveImage(img *Image, namer Namer) (*Saved, error)