imagor

package
v0.0.0-...-1f804bb Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, cfg Config) (*i.Imagor, error)

Types

type Config

type Config struct {
	KeyVal             *keyval.KeyVal
	UploadPath         string
	MaxUploadSize      int
	SignSecret         string
	AllowedHTTPSources string
	AutoWebP           bool
	AutoAVIF           bool
	ResultCacheTTL     time.Duration
	Concurrency        int
	RequestTimeout     time.Duration
	CacheControlTTL    time.Duration
	CacheControlSWR    time.Duration
	Debug              bool
}

type KVStorage

type KVStorage struct {
	KV              *keyval.KeyVal
	PathPrefix      string
	Blacklists      []*regexp.Regexp
	MkdirPermission os.FileMode
	WritePermission os.FileMode
	SaveErrIfExists bool
	SafeChars       string
	Expiration      time.Duration
	// contains filtered or unexported fields
}

KVStorage File Storage implements imagor.Storage interface

func NewKVStorage

func NewKVStorage(kv *keyval.KeyVal, uploadPath string) *KVStorage

New creates FileStorage

func (*KVStorage) Delete

func (s *KVStorage) Delete(_ context.Context, image string) error

Delete implements imagor.Storage interface

func (*KVStorage) Get

func (s *KVStorage) Get(_ *http.Request, image string) (*imagor.Blob, error)

Get implements imagor.Storage interface

func (*KVStorage) Path

func (s *KVStorage) Path(image string) (string, bool)

Path transforms and validates image key for storage path

func (*KVStorage) Put

func (s *KVStorage) Put(_ context.Context, image string, blob *imagor.Blob) (err error)

Put implements imagor.Storage interface

func (*KVStorage) Stat

func (s *KVStorage) Stat(_ context.Context, image string) (stat *imagor.Stat, err error)

Stat implements imagor.Storage interface

Jump to

Keyboard shortcuts

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