imaging

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2026 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProcessResult

type ProcessResult struct {
	Width    int
	Height   int
	MimeType string
	Size     int64
	FilePath string
}

ProcessResult contains the result of processing an uploaded image.

type Processor

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

Processor handles image processing operations using pure Go libraries.

func NewProcessor

func NewProcessor(uploadDir string) *Processor

NewProcessor creates a new image processor.

func (*Processor) CreateAllVariants

func (p *Processor) CreateAllVariants(sourcePath, uuid, filename string) ([]*VariantResult, error)

CreateAllVariants creates all standard variants for an image.

func (*Processor) CreateVariant

func (p *Processor) CreateVariant(sourcePath, uuid, filename string, config model.ImageVariantConfig, variantType string) (*VariantResult, error)

CreateVariant creates a resized variant of an image.

func (*Processor) DeleteMediaFiles

func (p *Processor) DeleteMediaFiles(uuid string) error

DeleteMediaFiles removes all files associated with a media item.

func (*Processor) DetectMimeType

func (p *Processor) DetectMimeType(data []byte) string

DetectMimeType detects the MIME type of image data.

func (*Processor) GetImageDimensions

func (p *Processor) GetImageDimensions(path string) (width, height int, err error)

GetImageDimensions returns the dimensions of an image file.

func (*Processor) IsImage

func (p *Processor) IsImage(mimeType string) bool

IsImage checks if a MIME type represents an image that can be processed.

func (*Processor) IsSupportedType

func (p *Processor) IsSupportedType(mimeType string) bool

IsSupportedType checks if a MIME type is supported for upload.

func (*Processor) ProcessImage

func (p *Processor) ProcessImage(reader io.Reader, uuid, filename string) (*ProcessResult, error)

ProcessImage reads an uploaded image file and returns its metadata. It saves the original file and returns processing results.

type VariantResult

type VariantResult struct {
	Type     string
	Width    int
	Height   int
	Size     int64
	FilePath string
}

VariantResult contains the result of creating an image variant.

Jump to

Keyboard shortcuts

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