upload

package
v0.0.0-...-d9c4052 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2014 License: GPL-3.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CodeAndMessageForUploadError

func CodeAndMessageForUploadError(err error) (int, string)

CodeAndMessageForUploadError returns a code and an error message for the given error

func RetrieveUploadedImage

func RetrieveUploadedImage(r *http.Request, key string) (io.ReadCloser, error)

RetrieveUploadedImage returns the uploaded file at the given key

func StoreImage

func StoreImage(file io.ReadCloser, options UploadOptions) (string, string, error)

StoreImage stores in disk a file received with the request

func ToLocalImagePath

func ToLocalImagePath(url string, config *services.Config) string

func ToLocalThumbnailPath

func ToLocalThumbnailPath(url string, config *services.Config) string

Types

type ByteSize

type ByteSize float64
const (
	KB ByteSize = 1 << (10 * iota)
	MB
	GB
	TB
	PB
	EB
	ZB
	YB
)

type UploadOptions

type UploadOptions struct {
	StorePath, ThumbnailStorePath, WebStorePath, WebThumbnailStorePath string
	MaxHeight, MaxWidth, ThumbnailHeight, ThumbnailWidth               int
}

func DefaultUploadOptions

func DefaultUploadOptions(config *services.Config) UploadOptions

DefaultUploadOptions returns the default configuration options for uploading

func ProfileUploadOptions

func ProfileUploadOptions(config *services.Config) UploadOptions

ProfileUploadOptions returns the default configuration options for uploading profile pictures

Jump to

Keyboard shortcuts

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