Documentation
¶
Overview ¶
Package imagefiles stores user-supplied images as files in a folder of Core's data directory: deck covers and the images set on games by hand.
Index ¶
Constants ¶
const (
// MaxBytes is the largest image a store keeps.
MaxBytes = 10 << 20
)
Variables ¶
var ( // ErrNotImage reports bytes that are not a supported image. ErrNotImage = errors.New("not a JPEG, PNG, GIF or WebP image") // ErrTooLarge reports an image over MaxBytes. ErrTooLarge = errors.New("image is larger than 10 MiB") // ErrNotFound reports an image file that is not stored. ErrNotFound = errors.New("image not found") )
Functions ¶
func ContentType ¶
ContentType reports the image type of data, or ErrNotImage.
Types ¶
type Store ¶
Store keeps images in one folder. A file is named after a caller's prefix and its content, so a new image never overwrites one a row still names, and files no row names are pruned.
func (*Store) Holds ¶
Holds reports whether path names a file in the store, whether or not the file is still there.
func (*Store) Path ¶
Path returns the full path of a stored image, or ErrNotFound when it is not stored. Any other error is a folder that could not be checked, not a missing image.
func (*Store) Prune ¶
Prune removes files not in keep. Files written in the last few minutes stay, since the row that names one may not be stored yet.