image

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package image provides image processing functions for the application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFileImageInfo

func GetFileImageInfo(fsPath string, params *ProcessParams) (model.FileInfo, error)

GetFileImageInfo get the file info for the image

func GetFileImageReader

func GetFileImageReader(fsPath string, params *ProcessParams) (*os.File, error)

GetFileImageReader get the file reader for the image

func ProcessImage

func ProcessImage(fs *os.File, p *ProcessParams) (*bytes.Buffer, error)

ProcessImage process the image with the given parameters

func RemoveImageCache

func RemoveImageCache(fsPath string)

RemoveImageCache remove the image cache

func SaveFileImageCache

func SaveFileImageCache(fsPath string, params *ProcessParams, buffer bytes.Buffer) error

SaveFileImageCache save the file to the image cache

Types

type PictureFormat

type PictureFormat string

PictureFormat the format of the picture

const (
	// PictureFormatJpeg The jpeg picture format
	PictureFormatJpeg PictureFormat = "jpeg"
	// PictureFormatPng The png picture format
	PictureFormatPng PictureFormat = "png"
	// PictureFormatGif The gif picture format
	PictureFormatGif PictureFormat = "gif"
)

type ProcessParams

type ProcessParams struct {
	Width   int           // The width of the image
	Height  int           // The height of the image
	Scale   ScaleType     // The scale type
	Quality int           // The quality of the image
	Angle   int           // The angle of the image
	Format  PictureFormat // The format of the image
}

ProcessParams the parameters for processing the image

func GetProcessParamsFromQuery

func GetProcessParamsFromQuery(query url.Values) *ProcessParams

GetProcessParamsFromQuery get the image process parameters from the query

func (*ProcessParams) Dump

func (i *ProcessParams) Dump() string

Dump the parameters

func (*ProcessParams) Print

func (i *ProcessParams) Print()

Print the parameters

type ScaleType

type ScaleType int

ScaleType the type of the scale

const (
	// ScaleTypeFit The fit scale type
	ScaleTypeFit ScaleType = iota
	// ScaleTypeFill The fill scale type
	ScaleTypeFill
	// ScaleTypeResize The resize scale type
	ScaleTypeResize
	// ScaleTypeFitWidth The fit width scale type
	ScaleTypeFitWidth
	// ScaleTypeFitHeight The fit height scale type
	ScaleTypeFitHeight
)

Jump to

Keyboard shortcuts

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