options

package
v3.24.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeURL

func DecodeURL(parts []string) (string, string, error)

func ParsePresets

func ParsePresets(presetStrs []string) error

func ValidatePresets

func ValidatePresets() error

Types

type CropOptions

type CropOptions struct {
	Width   float64
	Height  float64
	Gravity GravityOptions
}

type ExtendOptions

type ExtendOptions struct {
	Enabled bool
	Gravity GravityOptions
}

type GravityOptions

type GravityOptions struct {
	Type GravityType
	X, Y float64
}

func (*GravityOptions) RotateAndFlip added in v3.2.0

func (g *GravityOptions) RotateAndFlip(angle int, flip bool)

type GravityType

type GravityType int
const (
	GravityUnknown GravityType = iota
	GravityCenter
	GravityNorth
	GravityEast
	GravitySouth
	GravityWest
	GravityNorthWest
	GravityNorthEast
	GravitySouthWest
	GravitySouthEast
	GravitySmart
	GravityFocusPoint

	// Watermark gravity types
	GravityReplicate
)

func (GravityType) MarshalJSON

func (gt GravityType) MarshalJSON() ([]byte, error)

func (GravityType) OkForCrop added in v3.24.0

func (gt GravityType) OkForCrop() bool

func (GravityType) OkForExtend added in v3.24.0

func (gt GravityType) OkForExtend() bool

func (GravityType) OkForWatermark added in v3.24.0

func (gt GravityType) OkForWatermark() bool

func (GravityType) String

func (gt GravityType) String() string

type PaddingOptions

type PaddingOptions struct {
	Enabled bool
	Top     int
	Right   int
	Bottom  int
	Left    int
}

type ProcessingOptions

type ProcessingOptions struct {
	ResizingType      ResizeType
	Width             int
	Height            int
	MinWidth          int
	MinHeight         int
	ZoomWidth         float64
	ZoomHeight        float64
	Dpr               float64
	Gravity           GravityOptions
	Enlarge           bool
	Extend            ExtendOptions
	ExtendAspectRatio ExtendOptions
	Crop              CropOptions
	Padding           PaddingOptions
	Trim              TrimOptions
	Rotate            int
	Format            imagetype.Type
	Quality           int
	FormatQuality     map[imagetype.Type]int
	MaxBytes          int
	Flatten           bool
	Background        vips.Color
	Blur              float32
	Sharpen           float32
	Pixelate          int
	StripMetadata     bool
	KeepCopyright     bool
	StripColorProfile bool
	AutoRotate        bool
	EnforceThumbnail  bool

	SkipProcessingFormats []imagetype.Type

	CacheBuster string

	Expires *time.Time

	Watermark WatermarkOptions

	PreferWebP  bool
	EnforceWebP bool
	PreferAvif  bool
	EnforceAvif bool

	Filename         string
	ReturnAttachment bool

	Raw bool

	UsedPresets []string

	SecurityOptions security.Options
	// contains filtered or unexported fields
}

func NewProcessingOptions

func NewProcessingOptions() *ProcessingOptions

func ParsePath

func ParsePath(path string, headers http.Header) (*ProcessingOptions, string, error)

func (*ProcessingOptions) Diff

func (*ProcessingOptions) GetQuality

func (po *ProcessingOptions) GetQuality() int

func (*ProcessingOptions) MarshalJSON

func (po *ProcessingOptions) MarshalJSON() ([]byte, error)

func (*ProcessingOptions) String

func (po *ProcessingOptions) String() string

type ResizeType

type ResizeType int
const (
	ResizeFit ResizeType = iota
	ResizeFill
	ResizeFillDown
	ResizeForce
	ResizeAuto
)

func (ResizeType) MarshalJSON

func (rt ResizeType) MarshalJSON() ([]byte, error)

func (ResizeType) String

func (rt ResizeType) String() string

type TrimOptions

type TrimOptions struct {
	Enabled   bool
	Threshold float64
	Smart     bool
	Color     vips.Color
	EqualHor  bool
	EqualVer  bool
}

type WatermarkOptions

type WatermarkOptions struct {
	Enabled bool
	Opacity float64
	Gravity GravityOptions
	Scale   float64
}

func (WatermarkOptions) ShouldReplicate added in v3.24.0

func (wo WatermarkOptions) ShouldReplicate() bool

Jump to

Keyboard shortcuts

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