media_library

package
v3.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

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

Variables

View Source
var (
	QorPreviewSizeName = "@qor_preview"
	QorPreviewMaxSize  = 200
)

Functions

This section is empty.

Types

type MediaBox

type MediaBox struct {
	ID          json.Number
	Url         string
	VideoLink   string
	FileName    string
	Description string
	FileSizes   map[string]int `json:",omitempty"`
	// for default image
	Width  int `json:",omitempty"`
	Height int `json:",omitempty"`
}

func (*MediaBox) IsImage

func (mediaBox *MediaBox) IsImage() bool

IsImage return if it is an image

func (*MediaBox) IsSVG

func (mediaBox *MediaBox) IsSVG() bool

func (*MediaBox) IsVideo

func (mediaBox *MediaBox) IsVideo() bool

func (*MediaBox) Scan

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

func (*MediaBox) URL

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

func (*MediaBox) URLNoCached added in v3.0.4

func (mediaBox *MediaBox) URLNoCached(styles ...string) string

func (MediaBox) Value

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

func (MediaBox) WebpURL

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

type MediaBoxConfig

type MediaBoxConfig struct {
	Sizes     map[string]*base.Size
	Max       uint
	AllowType string
	// the background color of MediaBox
	BackgroundColor string
	// disable crop
	DisableCrop bool
	// allow to accept media_box only with URL
	SimpleIMGURL bool
}

MediaBoxConfig configure MediaBox metas

type MediaLibrary

type MediaLibrary struct {
	gorm.Model
	SelectedType string
	File         MediaLibraryStorage `sql:"size:4294967295;" mediaLibrary:"url:/system/{{class}}/{{primary_key}}/{{column}}.{{extension}}"`
	UserID       uint                `gorm:"index"`
	Folder       bool                `gorm:"default:false"`
	ParentId     uint                `gorm:"index;default:0"`
}

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 MediaLibraryStorage

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

func (*MediaLibraryStorage) GetSizes

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

func (*MediaLibraryStorage) Scan

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

func (*MediaLibraryStorage) URL

func (mediaLibraryStorage *MediaLibraryStorage) URL(styles ...string) string

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]*base.CropOption `json:",omitempty"`
	Sizes        map[string]*base.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