media_library

package
v0.0.0-...-ea25219 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2015 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotImplemented = errors.New("not implemented")

Functions

func SaveAndCropImage

func SaveAndCropImage(isCreate bool) func(scope *gorm.Scope)

Types

type Base

type Base struct {
	FileName   string
	Url        string
	CropOption *CropOption           `json:",omitempty"`
	Crop       bool                  `json:"-"`
	Valid      bool                  `json:"-"`
	FileHeader *multipart.FileHeader `json:"-"`
	Reader     io.Reader             `json:"-"`
}

func (*Base) GetCropOption

func (b *Base) GetCropOption() *image.Rectangle

func (Base) GetFileHeader

func (b Base) GetFileHeader() *multipart.FileHeader

func (Base) GetFileName

func (b Base) GetFileName() string

func (Base) GetSizes

func (b Base) GetSizes() map[string]Size

func (Base) GetURL

func (b Base) GetURL(option *Option, scope *gorm.Scope, field *gorm.Field) string

func (Base) GetURLTemplate

func (b Base) GetURLTemplate(option *Option) (path string)

func (Base) IsImage

func (b Base) IsImage() bool

func (Base) Retrieve

func (b Base) Retrieve(url string) (*os.File, error)

func (*Base) Scan

func (b *Base) Scan(data interface{}) (err error)

func (*Base) SetCropOption

func (b *Base) SetCropOption(option *CropOption)

func (Base) String

func (b Base) String() string

func (Base) URL

func (b Base) URL(styles ...string) string

func (Base) Value

func (b Base) Value() (driver.Value, error)

type CropOption

type CropOption struct {
	X, Y, Width, Height int
}

type FileSystem

type FileSystem struct {
	Base
}

func (FileSystem) GetFullPath

func (f FileSystem) GetFullPath(url string, option *Option) (path string, err error)

func (FileSystem) Retrieve

func (f FileSystem) Retrieve(url string) (*os.File, error)

func (FileSystem) Store

func (f FileSystem) Store(url string, option *Option, reader io.Reader) error

type MediaLibrary

type MediaLibrary interface {
	Scan(value interface{}) error
	Value() (driver.Value, error)

	GetURLTemplate(*Option) string
	GetURL(option *Option, scope *gorm.Scope, field *gorm.Field) string

	GetFileHeader() *multipart.FileHeader
	GetFileName() string

	GetSizes() map[string]Size
	SetCropOption(*CropOption)
	GetCropOption() *image.Rectangle

	Store(url string, option *Option, reader io.Reader) error
	Retrieve(url string) (*os.File, error)

	IsImage() bool

	URL(style ...string) string
	String() string
}

type Option

type Option map[string]string

func (Option) Get

func (option Option) Get(key string) string

type Size

type Size struct {
	Width  int
	Height int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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