qor: github.com/yanzay/qor/media_library Index | Files | Directories

package media_library

import "github.com/yanzay/qor/media_library"

Index

Package Files

base.go callback.go filesystem.go main.go

Variables

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

func SaveAndCropImage Uses

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

type Base Uses

type Base struct {
    FileName    string
    Url         string
    CropOptions map[string]*CropOption `json:",omitempty"`
    Crop        bool                   `json:"-"`
    Valid       bool                   `json:"-"`
    FileHeader  fileHeader             `json:"-"`
    Reader      io.Reader              `json:"-"`
    // contains filtered or unexported fields
}

func (*Base) Cropped Uses

func (b *Base) Cropped(values ...bool) (result bool)

func (*Base) GetCropOption Uses

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

func (Base) GetFileHeader Uses

func (b Base) GetFileHeader() fileHeader

func (Base) GetFileName Uses

func (b Base) GetFileName() string

func (Base) GetSizes Uses

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

func (Base) GetURL Uses

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

func (Base) GetURLTemplate Uses

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

func (Base) IsImage Uses

func (b Base) IsImage() bool

func (*Base) NeedCrop Uses

func (b *Base) NeedCrop() bool

func (Base) Retrieve Uses

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

func (*Base) Scan Uses

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

func (Base) String Uses

func (b Base) String() string

func (Base) URL Uses

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

func (Base) Value Uses

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

type CropOption Uses

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

type FileSystem Uses

type FileSystem struct {
    Base
}

func (FileSystem) GetFullPath Uses

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

func (FileSystem) Retrieve Uses

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

func (FileSystem) Store Uses

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

type MediaLibrary Uses

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

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

    GetFileHeader() fileHeader
    GetFileName() string

    GetSizes() map[string]Size
    NeedCrop() bool
    Cropped(values ...bool) bool
    GetCropOption(name string) *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 Uses

type Option map[string]string

func (Option) Get Uses

func (option Option) Get(key string) string

type Size Uses

type Size struct {
    Width  int
    Height int
}

type URLTemplater Uses

type URLTemplater interface {
    GetURLTemplate(*Option) string
}

Directories

PathSynopsis
aliyun
aliyun/config
aws
qiniu

Package media_library imports 18 packages (graph). Updated 2016-07-17. Refresh now. Tools for package owners. This is a dead-end fork (no commits since the fork).