file

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: May 26, 2017 License: MIT Imports: 14 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePathTo

func CreatePathTo(s string) error

CreatePathTo creates all directories enclosing this file path (which may not yet exist)

func Exists added in v1.3.4

func Exists(p string) bool

Exists returns true if this file exists and can be accessed for more complex requirements use os.Stat, this is a shortcut

func RemoveAccents

func RemoveAccents(s string) string

RemoveAccents replaces a set of accented characters with ascii equivalents.

func ResizeImage

func ResizeImage(src image.Image, maxWidth int64, maxHeight int64, square bool) (image.Image, error)

ResizeImage resizes the given image IF it is larger than maxWidth or maxHeight

func SanitizeName

func SanitizeName(s string) string

SanitizeName makes a string safe to use in a file name by first finding the path basename, then replacing non-ascii characters.

func SanitizeString

func SanitizeString(s string, r *regexp.Regexp) string

SanitizeString replaces separators with - and removes characters listed in the regexp provided from string. Accents, spaces, and all characters not in A-Za-z0-9 are replaced.

func Save

func Save(r io.Reader, path string) error

Save the file represented by io.Reader to disk at path

func SaveJpegRepresentations

func SaveJpegRepresentations(r io.Reader, options []Options) error

SaveJpegRepresentations saves several image representation rescaled in proportion (always in proportion) using the specified max width, max height and quality

func SavePNGRepresentations

func SavePNGRepresentations(r io.Reader, options []Options) error

SavePNGRepresentations saves png representations according to options

Types

type Options

type Options struct {
	Path      string
	MaxHeight int64
	MaxWidth  int64
	Quality   int
}

Options represents image options

Jump to

Keyboard shortcuts

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