cdn

package
v0.0.0-...-52787d2 Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var I18nMessages = messages{
	InternalError:   "cdn_internal_error",
	ContentRequired: "cdn_content_required",
	TypeNotAccepted: "cdn_type_not_accepted",
	SizeTooBig:      "cdn_size_too_big",
	SizeTooSmall:    "cdn_size_too_small",
}

Functions

This section is empty.

Types

type Errors

type Errors interface {
	InternalError() *i18np.Error
	ContentRequired() *i18np.Error
	TypeNotAccepted([]string, string) *i18np.Error
	SizeTooBig(int64) *i18np.Error
	SizeTooSmall(int64) *i18np.Error
}

type Factory

type Factory struct {
	Errors Errors
	// contains filtered or unexported fields
}

func NewFactory

func NewFactory() Factory

func (Factory) GenerateDirName

func (f Factory) GenerateDirName(dir string, isAdmin bool, fb string) string

func (Factory) GenerateName

func (f Factory) GenerateName(name string, random bool, slugify bool) string

func (Factory) GetExtension

func (f Factory) GetExtension(content *multipart.FileHeader) string

func (Factory) New

func (f Factory) New(cnf ValidateConfig) ([]byte, *i18np.Error)

func (Factory) NewImage

func (f Factory) NewImage(cnf ValidateConfig) ([]byte, *i18np.Error)

func (Factory) RandomName

func (f Factory) RandomName() string

func (Factory) Validate

func (f Factory) Validate(cnf ValidateConfig) *i18np.Error

type MinifyLevel

type MinifyLevel float32
const (
	MinifyLevelNone   MinifyLevel = iota
	MinifyLevelLow    MinifyLevel = 2   // 2 MB
	MinifyLevelMedium MinifyLevel = 1   // 1 MB
	MinifyLevelHigh   MinifyLevel = 0.5 // 0.5 MB
)

type Repository

type Repository interface {
	Upload(file []byte, filename string, path ...string) (string, bool)
}

type ValidateConfig

type ValidateConfig struct {
	Content     *multipart.FileHeader
	Accept      []string
	MaxSize     int64
	MinSize     int64
	Width       int
	MinWidth    int
	MaxWidth    int
	Height      int
	MinHeight   int
	MaxHeight   int
	MinifyLevel MinifyLevel
}

Jump to

Keyboard shortcuts

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