upmedia

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MediaImage    = 1
	MediaVideo    = 2
	MediaAudio    = 3
	MediaDocument = 4
)

Variables

View Source
var WebFiles embed.FS

WebFiles are the package's web resources (templates and static files)

Functions

func FixOrientation

func FixOrientation(img image.Image, o orientation) image.Image

FixOrientation applies a transform to img corresponding to the given orientation flag.

func OrientationSize

func OrientationSize(size image.Point, o orientation) image.Point

OrientationSize returns the dimensions of the image after orientation is changed.

func ReadOrientation

func ReadOrientation(r io.Reader) orientation

ReadOrientation tries to read the orientation EXIF flag from image data in r. If the EXIF data block is not found or the orientation flag is not found or any other error occures while reading the data, it returns the orientationUnspecified (0) value.

Types

type UpAudioVisual

type UpAudioVisual struct {
	MaxSize         int           // maximum size for AV to use original without processing
	SnapshotAt      time.Duration // snapshot time in video (-ve for none)
	VideoResolution int
	// contains filtered or unexported fields
}

func (*UpAudioVisual) Save

func (up *UpAudioVisual) Save(req uploader.ReqSave) (bool, error)

Save saves the audio or video file and a thumbnail. It returns false if format conversion is needed.

func (*UpAudioVisual) Thumbnail

func (up *UpAudioVisual) Thumbnail(filename string) string

Thumbnail returns the prefixed name for a thumbnail.

type UpDocument

type UpDocument struct {
	// contains filtered or unexported fields
}

func (*UpDocument) Save

func (up *UpDocument) Save(req uploader.ReqSave) (bool, error)

Save saves the document file and a thumbnail. It always returns true, because there are no conversions.

func (*UpDocument) Thumbnail

func (up *UpDocument) Thumbnail(filename string) string

Thumbnail returns the prefixed name for a thumbnail.

type UpImage

type UpImage struct {
	ImageQuality int // JPEG quality, 1-100
	MaxDecoded   int // maximum decoded image size (bytes)
	MaxW         int
	MaxH         int
	// contains filtered or unexported fields
}

func (*UpImage) Save

func (up *UpImage) Save(req uploader.ReqSave) (bool, error)

Save completes image saving, converting and resizing as needed. It always returns true because processing is synchronous.

func (*UpImage) Thumbnail

func (up *UpImage) Thumbnail(filename string) string

Thumbnail returns the prefixed name for a thumbnail.

type UpMedia

type UpMedia struct {

	// media processors, linked here to allow parameter changes
	AV       *UpAudioVisual
	Document *UpDocument
	Image    *UpImage

	// parameters for multiple media processors
	ThumbW       int
	ThumbH       int
	ThumbQuality int // between 1 and 100
	// contains filtered or unexported fields
}

func NewUpMedia

func NewUpMedia(uploader *uploader.Uploader, audioTypes []string, documentTypes []string, videoTypes []string, videoPackage string) *UpMedia

NewUpMedia starts and returns media processors for webparts/uploader. Public parameters may be changed before the first call to uploader.Begin.

Jump to

Keyboard shortcuts

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