Documentation ¶
Index ¶
- Variables
- func SaveAndCropImage(isCreate bool) func(scope *gorm.Scope)
- type Base
- func (b *Base) GetCropOption(name string) *image.Rectangle
- func (b Base) GetFileHeader() fileHeader
- func (b Base) GetFileName() string
- func (b Base) GetSizes() map[string]Size
- func (b Base) GetURL(option *Option, scope *gorm.Scope, field *gorm.Field, templater URLTemplater) string
- func (b Base) GetURLTemplate(option *Option) (path string)
- func (b Base) IsImage() bool
- func (b *Base) NeedCrop() bool
- func (b Base) Retrieve(url string) (*os.File, error)
- func (b *Base) Scan(data interface{}) (err error)
- func (b Base) String() string
- func (b Base) URL(styles ...string) string
- func (b Base) Value() (driver.Value, error)
- type CropOption
- type FileSystem
- type MediaLibrary
- type Option
- type Size
- type URLTemplater
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotImplemented = errors.New("not implemented")
Functions ¶
func SaveAndCropImage ¶
Types ¶
type Base ¶
type Base struct { FileName string `sql:"size:10240"` Url string CropOptions map[string]*CropOption `json:",omitempty"` Crop bool `json:"-"` Valid bool `json:"-"` FileHeader fileHeader `json:"-"` Reader io.Reader `json:"-"` }
func (Base) GetFileHeader ¶
func (b Base) GetFileHeader() fileHeader
func (Base) GetFileName ¶
func (Base) GetURLTemplate ¶
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)
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, templater URLTemplater) string GetFileHeader() fileHeader GetFileName() string GetSizes() map[string]Size NeedCrop() 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 URLTemplater ¶
Click to show internal directories.
Click to hide internal directories.