utils

package
v0.0.0-...-473bd5b Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetResizedPhotoURL

func GetResizedPhotoURL(pic *client.Photo, rOptions ResizeOptions) string

GetResizedPhotoURL takes a picture and a ResizeOptions object, dynamically resizes Photo.URLs.Raw using the options and returns the resulting URL

Types

type ResizeOptions

type ResizeOptions struct {
	Width       string
	Height      string
	Crop        string // https://docs.imgix.com/apis/rendering/size/crop
	ImageFormat string // https://docs.imgix.com/apis/rendering/format/fm
	Auto        string // https://docs.imgix.com/apis/rendering/auto/auto
	Quality     string //for changing the compression quality when using lossy file formats
	// https://docs.imgix.com/apis/rendering/format/q
	Fit string // for changing the fit of the image within the specified dimensions
	// https://docs.imgix.com/apis/rendering/size/fit
	DevicePixelRatio string // min-value is 1, max-value is 5

}

ResizeOptions defines parameters that resize a photo Resizing is done using Imgix()

func NewDefaultResizeOptions

func NewDefaultResizeOptions(w, h int) *ResizeOptions

NewDefaultResizeOptions takes in width and height to return a new default ResizeOptions with custom dimensions

func (ResizeOptions) String

func (rOptions ResizeOptions) String() string

Jump to

Keyboard shortcuts

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