Documentation ¶
Overview ¶
Package imager handles image, video, etc. upload requests and processing.
Index ¶
- Variables
- func DeallocateImage(id string) error
- func FindImageThumb(hash string) (img types.ImageCommon, err error)
- func InitImager() error
- func NewImageToken(SHA1 string) (code int, token string, err error)
- func NewImageUpload(res http.ResponseWriter, req *http.Request)
- func UseImageToken(id string) (img types.ImageCommon, err error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidToken occurs, when trying to retrieve an image with an // non-existant token. The token might have expired (60 to 119 seconds) or // the client could have provided an invalid token to begin with. ErrInvalidToken = errors.New("invalid image token") )
Functions ¶
func DeallocateImage ¶
DeallocateImage decrements the image's refference counter. If the counter would become zero, the image entry is immediately deleted allong with its file assets.
func FindImageThumb ¶
func FindImageThumb(hash string) (img types.ImageCommon, err error)
FindImageThumb searches for an existing image with the specified hash and returns it, if it exists. Otherwise, returns an empty struct. To ensure the image is not deallocated by another theread/process, the refference counter of the image will be incremented.
func InitImager ¶
func InitImager() error
InitImager applies the thumbnail quality configuration and starts the image token expiry scheduler
func NewImageToken ¶
NewImageToken inserts a new expiring image token document into the DB and returns it's ID
func NewImageUpload ¶
func NewImageUpload(res http.ResponseWriter, req *http.Request)
NewImageUpload handles the clients' image (or other file) upload request
func UseImageToken ¶
func UseImageToken(id string) (img types.ImageCommon, err error)
UseImageToken deletes a document from the "imageTokens" table and uses and returns the Image document from the "images" table, the token was created for. If no token exists, returns ErrInvalidToken.
Types ¶
This section is empty.