Documentation ¶
Overview ¶
Package image provides image processing functions for the application.
Index ¶
- func GetFileImageInfo(fsPath string, params *ProcessParams) (model.FileInfo, error)
- func GetFileImageReader(fsPath string, params *ProcessParams) (*os.File, error)
- func ProcessImage(fs *os.File, p *ProcessParams) (*bytes.Buffer, error)
- func RemoveImageCache(fsPath string)
- func SaveFileImageCache(fsPath string, params *ProcessParams, buffer bytes.Buffer) error
- type PictureFormat
- type ProcessParams
- type ScaleType
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 ¶
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
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 )
Click to show internal directories.
Click to hide internal directories.