Documentation ¶
Index ¶
Constants ¶
View Source
const ( // CroppingModeExact crops an image exactly to given dimensions CroppingModeExact = "e" // CroppingModeAll crops an image so that all of it is displayed in a frame of at most given dimensions CroppingModeAll = "a" // CroppingModePart crops an image so that it fills a frame of given dimensions CroppingModePart = "p" // CroppingModeKeepScale crops an image so that it fills a frame of given dimensions, keeps scale CroppingModeKeepScale = "k" GravityNorth = "n" GravityNorthEast = "ne" GravityEast = "e" GravitySouthEast = "se" GravitySouth = "s" GravitySouthWest = "sw" GravityWest = "w" GravityNorthWest = "nw" GravityCenter = "c" FilterGrayScale = "grayscale" DefaultScale = 1 DefaultCroppingMode = CroppingModeExact DefaultGravity = GravityNorthWest DefaultFilter = "none" MaxDimension = 10000 )
Variables ¶
View Source
var Module = module.Module{ ModuleName: "image", ModuleVersion: "1.1.0", ModuleConfig: imageConfig, ModuleDepends: []string{ "user", }, ModuleEnv: map[string]any{ "cache.evict": onEvict, }, ModuleExport: map[string]any{}, ModulePerm: map[string]string{ "image.upload": "上传图片", "image.view": "查看图片", "image.custom": "处理图片", }, EntryPoint: entry, }
Functions ¶
This section is empty.
Types ¶
type FontMetrics ¶
type FontMetrics struct {
// contains filtered or unexported fields
}
FontMetrics defines font metrics for a Text struct as rounded up integers
type Params ¶
Params is a struct of parameters specifying an image transformation
type Text ¶
type Text struct {
// contains filtered or unexported fields
}
Text specifies a text overlay to be applied to an image
type TextInfo ¶
type TextInfo struct { Content string `mapstructure:"content" yaml:"content"` Gravity string `mapstructure:"gravity" yaml:"gravity"` FontPath string `mapstructure:"font" yaml:"font"` X int `mapstructure:"x-pos" yaml:"x-pos"` Y int `mapstructure:"y-pos" yaml:"y-pos"` Size int `mapstructure:"size" yaml:"size"` Color string `mapstructure:"color" yaml:"color"` Alpha float64 `mapstructure:"alpha" yaml:"alpha"` }
type Transformation ¶
type Transformation struct { Hash string // contains filtered or unexported fields }
Transformation specifies parameters and a watermark to be used when transforming an image
type TransformationInfo ¶
type TransformationInfo struct { Name string `mapstructure:"name" yaml:"name"` Params string `mapstructure:"params" yaml:"params"` Texts []TextInfo `mapstructure:"texts" yaml:"texts"` Default bool `mapstructure:"default" yaml:"default"` Eager bool `mapstructure:"eager" yaml:"eager"` }
TransformationInfo for config parsing.
func (*TransformationInfo) ToTransformation ¶
func (t *TransformationInfo) ToTransformation() *Transformation
Click to show internal directories.
Click to hide internal directories.