data

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2013 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package data provides common shared data structures for imageproxy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Image

type Image struct {
	// URL of original remote image.
	URL string

	// Expires is the cache expiration time for the original image, as
	// returned by the remote server.
	Expires time.Time

	// Etag returned from server when fetching image.
	Etag string

	// Bytes contains the actual image.
	Bytes []byte
}

Image represents a remote image that is being proxied. It tracks where the image was originally retrieved from and how long the image can be cached.

type Options

type Options struct {
	Width  float64 // requested width, in pixels
	Height float64 // requested height, in pixels

	// If true, resize the image to fit in the specified dimensions.  Image
	// will not be cropped, and aspect ratio will be maintained.
	Fit bool

	// Rotate image the specified degrees counter-clockwise.  Valid values are 90, 180, 270.
	Rotate int

	FlipVertical   bool
	FlipHorizontal bool
}

Options specifies transformations that can be performed on a requested image.

func ParseOptions

func ParseOptions(str string) *Options

func (Options) String

func (o Options) String() string

type Request

type Request struct {
	URL     *url.URL // URL of the image to proxy
	Options *Options // Image transformation to perform
}

Jump to

Keyboard shortcuts

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