Documentation
¶
Overview ¶
Package attach ingests uploaded images and videos: it sniffs the real content type, optionally optimizes images (EXIF-orient, downscale, re-encode to lossy WebP, keep-smaller), and returns the bytes to persist plus metadata. It never touches the filesystem, so it is pure and easily tested; the caller writes the returned bytes through the store.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUnsupported = errors.New("unsupported file type") ErrTooLarge = errors.New("image is too large (over 50 megapixels)") ErrDecode = errors.New("could not decode image") )
Errors surfaced to HTTP handlers.
Functions ¶
Types ¶
type Config ¶
Config controls optimization, derived from config.json's attachments block.
func FromConfig ¶
func FromConfig(a config.Attachments) Config
FromConfig adapts the persisted attachments config.
Click to show internal directories.
Click to hide internal directories.