imager

package
v6.0.0-...-7081d96 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2016 License: AGPL-3.0, AGPL-3.0-or-later Imports: 25 Imported by: 0

Documentation

Overview

Package imager handles image, video, etc. upload requests and processing.

Index

Constants

This section is empty.

Variables

View Source
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

func DeallocateImage(id string) error

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

func NewImageToken(SHA1 string) (code int, token string, err error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL