media_library

package
v0.0.0-...-b7a9f98 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2019 License: MIT Imports: 15 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ALLOW_TYPE_FILE  = "file"
	ALLOW_TYPE_IMAGE = "image"
	ALLOW_TYPE_VIDEO = "video"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	ID          json.Number
	Url         string
	VideoLink   string
	FileName    string
	Description string
}

func (File) IsImage

func (f File) IsImage() bool

IsImage return if it is an image

func (File) IsSVG

func (f File) IsSVG() bool

func (File) IsVideo

func (f File) IsVideo() bool

func (File) URL

func (file File) URL(styles ...string) string

type MediaBox

type MediaBox struct {
	Values string `json:"-" gorm:"size:4294967295;"`
	Files  []File `json:",omitempty"`
}

func (MediaBox) ConfigureQorMeta

func (mediaBox MediaBox) ConfigureQorMeta(metaor resource.Metaor)

func (MediaBox) Crop

func (mediaBox MediaBox) Crop(res *admin.Resource, db *gorm.DB, mediaOption MediaOption) (err error)

func (*MediaBox) Scan

func (mediaBox *MediaBox) Scan(data interface{}) (err error)

func (MediaBox) URL

func (mediaBox MediaBox) URL(styles ...string) string

func (MediaBox) Value

func (mediaBox MediaBox) Value() (driver.Value, error)

type MediaBoxConfig

type MediaBoxConfig struct {
	RemoteDataResource *admin.Resource
	Sizes              map[string]*media.Size
	Max                uint
	AllowType          string
	admin.SelectManyConfig
}

MediaBoxConfig configure MediaBox metas

func (*MediaBoxConfig) ConfigureQorMeta

func (*MediaBoxConfig) ConfigureQorMeta(resource.Metaor)

func (*MediaBoxConfig) GetTemplate

func (*MediaBoxConfig) GetTemplate(context *admin.Context, metaType string) ([]byte, error)

type MediaLibrary

type MediaLibrary struct {
	gorm.Model
	SelectedType string
	File         MediaLibraryStorage `sql:"size:4294967295;" media_library:"url:/system/{{class}}/{{primary_key}}/{{column}}.{{extension}}"`
}

func (MediaLibrary) ConfigureQorResource

func (MediaLibrary) ConfigureQorResource(res resource.Resourcer)

func (*MediaLibrary) GetMediaOption

func (mediaLibrary *MediaLibrary) GetMediaOption() MediaOption

func (*MediaLibrary) GetSelectedType

func (mediaLibrary *MediaLibrary) GetSelectedType() string

func (*MediaLibrary) ScanMediaOptions

func (mediaLibrary *MediaLibrary) ScanMediaOptions(mediaOption MediaOption) error

func (*MediaLibrary) SetSelectedType

func (mediaLibrary *MediaLibrary) SetSelectedType(typ string)

type MediaLibraryInterface

type MediaLibraryInterface interface {
	ScanMediaOptions(MediaOption) error
	SetSelectedType(string)
	GetSelectedType() string
	GetMediaOption() MediaOption
}

type MediaLibraryStorage

type MediaLibraryStorage struct {
	oss.OSS
	Sizes        map[string]*media.Size `json:",omitempty"`
	Video        string
	SelectedType string
	Description  string
}

func (MediaLibraryStorage) ConfigureQorMeta

func (mediaLibraryStorage MediaLibraryStorage) ConfigureQorMeta(metaor resource.Metaor)

func (MediaLibraryStorage) GetSizes

func (mediaLibraryStorage MediaLibraryStorage) GetSizes() map[string]*media.Size

func (*MediaLibraryStorage) Scan

func (mediaLibraryStorage *MediaLibraryStorage) Scan(data interface{}) (err error)

func (MediaLibraryStorage) Value

func (mediaLibraryStorage MediaLibraryStorage) Value() (driver.Value, error)

type MediaOption

type MediaOption struct {
	Video        string                       `json:",omitempty"`
	FileName     string                       `json:",omitempty"`
	URL          string                       `json:",omitempty"`
	OriginalURL  string                       `json:",omitempty"`
	CropOptions  map[string]*media.CropOption `json:",omitempty"`
	Sizes        map[string]*media.Size       `json:",omitempty"`
	SelectedType string                       `json:",omitempty"`
	Description  string                       `json:",omitempty"`
	Crop         bool
}

Jump to

Keyboard shortcuts

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