imageproxy

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fake

type Fake struct{}

Fake returns the input unchanged

func NewFakeService

func NewFakeService() *Fake

NewFakeService creates a new fake image proxy service

func (*Fake) GenerateURL

func (fake *Fake) GenerateURL(sourceURL string, config ImageConfig) (string, error)

GenerateURL appends the ImageConfig width to the sourceURL: <sourceURL>/<width>

type ImageConfig

type ImageConfig struct {
	Width        int
	Height       int
	ResizingType ResizingType
}

func ParseImageConfig

func ParseImageConfig(width, height, resizingType string) (ImageConfig, error)

func (ImageConfig) String

func (config ImageConfig) String() string

func (ImageConfig) Validate

func (config ImageConfig) Validate() error

type ImgProxy

type ImgProxy struct {
	// contains filtered or unexported fields
}

ImgProxy provides helper functions for working with imgproxy. See https://imgproxy.net/

func NewImgProxyService

func NewImgProxyService(baseURL, keyHex, saltHex string, allowedConfigs []ImageConfig) (*ImgProxy, error)

NewImgProxyService creates a new ImgProxy service

func (*ImgProxy) GenerateURL

func (imgproxy *ImgProxy) GenerateURL(sourceURL string, config ImageConfig) (string, error)

GenerateURL generates a signed URL for imgproxy

type ResizingType

type ResizingType string
const ResizingTypeFill ResizingType = "FILL"
const ResizingTypeFit ResizingType = "FIT"

func ParseResizingType

func ParseResizingType(input string) (ResizingType, error)

type Service

type Service interface {
	// GenerateURL generates a signed URL for the image proxy
	GenerateURL(sourceURL string, config ImageConfig) (string, error)
}

Service interface

Jump to

Keyboard shortcuts

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