image

package
v0.0.0-...-0113a05 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2015 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultFormat = imaging.PNG

Variables

View Source
var ContentTypes = map[string]string{
	"jpeg": "image/jpeg",
	"jpg":  "image/jpeg",
	"png":  "image/png",
	"bmp":  "image/bmp",
	"gif":  "image/gif",
}
View Source
var Extensions = map[string]string{
	"image/jpeg": "jpg",
	"image/png":  "png",
	"image/bmp":  "bmp",
	"image/gif":  "gif",
}
View Source
var Formats = map[string]imaging.Format{
	"image/jpeg": imaging.JPEG,
	"image/png":  imaging.PNG,
	"image/gif":  imaging.GIF,
	"image/bmp":  imaging.BMP,
}
View Source
var HeaderKeys = []string{
	"Age",
	"Content-Type",
	"Last-Modified",
	"Date",
	"Etag",
}
View Source
var Operations = map[string]*Operation{
	Resize.Name:    Resize,
	Thumbnail.Name: Thumbnail,
}
View Source
var Resize = &Operation{
	"resize",
	imaging.Resize,
}
View Source
var Thumbnail = &Operation{
	"thumbnail",
	imaging.Thumbnail,
}

Functions

This section is empty.

Types

type ImageFile

type ImageFile struct {
	Source   []byte
	Image    image.Image
	Key      string
	Headers  map[string]string
	Filepath string
	Storage  gostorages.Storage
}

func FromStorage

func FromStorage(storage gostorages.Storage, filepath string) (*ImageFile, error)

func FromURL

func FromURL(u *url.URL) (*ImageFile, error)

func (*ImageFile) ContentType

func (i *ImageFile) ContentType() string

func (*ImageFile) Filename

func (i *ImageFile) Filename() string

func (*ImageFile) FilenameExt

func (i *ImageFile) FilenameExt() string

func (*ImageFile) Format

func (i *ImageFile) Format() string

func (*ImageFile) ImageSize

func (i *ImageFile) ImageSize() (int, int)

func (*ImageFile) Path

func (i *ImageFile) Path() string

func (*ImageFile) Save

func (i *ImageFile) Save() error

func (*ImageFile) SaveWithFormat

func (i *ImageFile) SaveWithFormat(format imaging.Format) error

func (*ImageFile) Scale

func (i *ImageFile) Scale(dstWidth int, dstHeight int, upscale bool, trans Transformation) *image.NRGBA

func (*ImageFile) ToBytes

func (i *ImageFile) ToBytes() ([]byte, error)

func (*ImageFile) ToBytesWithFormat

func (i *ImageFile) ToBytesWithFormat(format imaging.Format) ([]byte, error)

func (*ImageFile) Transform

func (i *ImageFile) Transform(operation *Operation, qs map[string]string) (*ImageFile, error)

func (*ImageFile) URL

func (i *ImageFile) URL() string

type Operation

type Operation struct {
	Name           string
	Transformation Transformation
}

type Transformation

type Transformation func(img image.Image, width, height int, filter imaging.ResampleFilter) *image.NRGBA

Jump to

Keyboard shortcuts

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