media

package
v0.0.0-...-af9d6d6 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2022 License: MPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeImage = "image"
	TypeVideo = "video"
)

Variables

This section is empty.

Functions

func NormalizeSize

func NormalizeSize(media, requested image.Rectangle) image.Rectangle

func ParseSizeString

func ParseSizeString(str string, actual image.Rectangle) (image.Rectangle, error)

func SizeRequested

func SizeRequested(urlpath string, actual image.Rectangle) (image.Rectangle, error)

func ThumbImage

func ThumbImage(filename string, img image.Image, size image.Rectangle) error

func VideoEncode

func VideoEncode(filename string, size image.Rectangle, thumbDir string) error

func VideoFrame

func VideoFrame(filename string) (image.Image, error)

func VideoSize

func VideoSize(filename string) (image.Rectangle, error)

Types

type Media

type Media struct {
	Type     string
	Name     string
	Size     image.Rectangle
	FullName string
	// contains filtered or unexported fields
}

func (*Media) Date

func (m *Media) Date() time.Time

func (Media) NormalizeSize

func (m Media) NormalizeSize(size image.Rectangle) image.Rectangle

func (Media) ThumbFilename

func (m Media) ThumbFilename(size image.Rectangle) string

func (Media) ThumbPath

func (m Media) ThumbPath(size image.Rectangle) string

type MediaSource

type MediaSource struct {
	StorageDir string
	ThumbDir   string
	// contains filtered or unexported fields
}

func (*MediaSource) ByName

func (ms *MediaSource) ByName(name string) (*Media, error)

func (*MediaSource) HasThumb

func (ms *MediaSource) HasThumb(m Media, size image.Rectangle) bool

func (*MediaSource) ReceiveNewMedia

func (ms *MediaSource) ReceiveNewMedia(name string, r io.Reader) error

func (*MediaSource) ServeHTTP

func (ms *MediaSource) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*MediaSource) Size

func (ms *MediaSource) Size(name string) (image.Rectangle, error)

func (*MediaSource) Thumb

func (ms *MediaSource) Thumb(m Media, size image.Rectangle) (image.Rectangle, error)

func (*MediaSource) ThumbFilename

func (ms *MediaSource) ThumbFilename(m Media, size image.Rectangle) string

func (*MediaSource) ThumbMax

func (ms *MediaSource) ThumbMax(m Media, maxDim int) (image.Rectangle, error)

func (*MediaSource) ThumbPath

func (ms *MediaSource) ThumbPath(m Media, size image.Rectangle) string

func (*MediaSource) Walk

func (ms *MediaSource) Walk() ([]*Media, error)

type Set

type Set []*Media

func (Set) ByDate

func (s Set) ByDate() Set

Jump to

Keyboard shortcuts

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