Versions in this module Expand all Collapse all v1 v1.4.0 Feb 5, 2023 v1.3.9 Feb 5, 2023 Changes in this version + const Version + var ErrExpired = NewError("expired", http.StatusGone) + var ErrInternal = NewError("internal error", http.StatusInternalServerError) + var ErrInvalid = NewError("invalid", http.StatusBadRequest) + var ErrMaxResolutionExceeded = NewError("maximum resolution exceeded", http.StatusUnprocessableEntity) + var ErrMaxSizeExceeded = NewError("maximum size exceeded", http.StatusBadRequest) + var ErrMethodNotAllowed = NewError("method not allowed", http.StatusMethodNotAllowed) + var ErrNotFound = NewError("not found", http.StatusNotFound) + var ErrSignatureMismatch = NewError("url signature mismatch", http.StatusForbidden) + var ErrTimeout = NewError("timeout", http.StatusRequestTimeout) + var ErrTooManyRequests = NewError("too many requests", http.StatusTooManyRequests) + var ErrUnsupportedFormat = NewError("unsupported format", http.StatusNotAcceptable) + type Blob struct + Stat *Stat + func NewBlob(newReader func() (reader io.ReadCloser, size int64, err error)) *Blob + func NewBlobFromBytes(buf []byte) *Blob + func NewBlobFromFile(filepath string, checks ...func(os.FileInfo) error) *Blob + func NewBlobFromJsonMarshal(v any) *Blob + func NewBlobFromMemory(buf []byte, width, height, bands int) *Blob + func NewEmptyBlob() *Blob + func (b *Blob) BlobType() BlobType + func (b *Blob) ContentType() string + func (b *Blob) Err() error + func (b *Blob) FilePath() string + func (b *Blob) IsEmpty() bool + func (b *Blob) Memory() (data []byte, width, height, bands int, ok bool) + func (b *Blob) NewReadSeeker() (io.ReadSeekCloser, int64, error) + func (b *Blob) NewReader() (reader io.ReadCloser, size int64, err error) + func (b *Blob) ReadAll() ([]byte, error) + func (b *Blob) SetContentType(contentType string) + func (b *Blob) Size() int64 + func (b *Blob) Sniff() []byte + func (b *Blob) SupportsAnimation() bool + type BlobType int + const BlobTypeAVIF + const BlobTypeBMP + const BlobTypeEmpty + const BlobTypeGIF + const BlobTypeHEIF + const BlobTypeJP2 + const BlobTypeJPEG + const BlobTypeJSON + const BlobTypeMemory + const BlobTypePNG + const BlobTypeTIFF + const BlobTypeUnknown + const BlobTypeWEBP + type ErrForward struct + func (p ErrForward) Error() string + type Error struct + Code int + Message string + func NewError(msg string, code int) Error + func NewErrorFromStatusCode(code int) Error + func WrapError(err error) Error + func (e Error) Error() string + func (e Error) Timeout() bool + type Imagor struct + AutoAVIF bool + AutoWebP bool + BaseParams string + BasePathRedirect string + CacheHeaderSWR time.Duration + CacheHeaderTTL time.Duration + Debug bool + DisableErrorBody bool + DisableParamsEndpoint bool + LoadTimeout time.Duration + Loaders []Loader + Logger *zap.Logger + ModifiedTimeCheck bool + ProcessConcurrency int64 + ProcessQueueSize int64 + ProcessTimeout time.Duration + Processors []Processor + RequestTimeout time.Duration + ResultStoragePathStyle imagorpath.ResultStorageHasher + ResultStorages []Storage + SaveTimeout time.Duration + Signer imagorpath.Signer + StoragePathStyle imagorpath.StorageHasher + Storages []Storage + Unsafe bool + func New(options ...Option) *Imagor + func (app *Imagor) Do(r *http.Request, p imagorpath.Params) (blob *Blob, err error) + func (app *Imagor) Serve(ctx context.Context, p imagorpath.Params) (*Blob, error) + func (app *Imagor) ServeBlob(ctx context.Context, blob *Blob, p imagorpath.Params) (*Blob, error) + func (app *Imagor) ServeHTTP(w http.ResponseWriter, r *http.Request) + func (app *Imagor) Shutdown(ctx context.Context) (err error) + func (app *Imagor) Startup(ctx context.Context) (err error) + type LoadFunc func(string) (*Blob, error) + type Loader interface + Get func(r *http.Request, key string) (*Blob, error) + type Option func(app *Imagor) + func WithAutoAVIF(enable bool) Option + func WithAutoWebP(enable bool) Option + func WithBaseParams(params string) Option + func WithBasePathRedirect(url string) Option + func WithCacheHeaderNoCache(nocache bool) Option + func WithCacheHeaderSWR(swr time.Duration) Option + func WithCacheHeaderTTL(ttl time.Duration) Option + func WithDebug(debug bool) Option + func WithDisableErrorBody(disabled bool) Option + func WithDisableParamsEndpoint(disabled bool) Option + func WithLoadTimeout(timeout time.Duration) Option + func WithLoaders(loaders ...Loader) Option + func WithLogger(logger *zap.Logger) Option + func WithModifiedTimeCheck(enabled bool) Option + func WithOptions(options ...Option) Option + func WithProcessConcurrency(concurrency int64) Option + func WithProcessQueueSize(size int64) Option + func WithProcessTimeout(timeout time.Duration) Option + func WithProcessors(processors ...Processor) Option + func WithRequestTimeout(timeout time.Duration) Option + func WithResultStoragePathStyle(hasher imagorpath.ResultStorageHasher) Option + func WithResultStorages(savers ...Storage) Option + func WithSaveTimeout(timeout time.Duration) Option + func WithSigner(signer imagorpath.Signer) Option + func WithStoragePathStyle(hasher imagorpath.StorageHasher) Option + func WithStorages(savers ...Storage) Option + func WithUnsafe(unsafe bool) Option + type Processor interface + Process func(ctx context.Context, blob *Blob, params imagorpath.Params, load LoadFunc) (*Blob, error) + Shutdown func(ctx context.Context) error + Startup func(ctx context.Context) error + type Stat struct + ETag string + ModifiedTime time.Time + Size int64 + type Storage interface + Delete func(ctx context.Context, key string) error + Get func(r *http.Request, key string) (*Blob, error) + Put func(ctx context.Context, key string, blob *Blob) error + Stat func(ctx context.Context, key string) (*Stat, error)