mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-09-25 19:24:38 +02:00
Merge branch 'version/3' into version/3-refactoring
This commit is contained in:
@@ -84,6 +84,7 @@ type ProcessingOptions struct {
|
||||
Background vips.Color
|
||||
Blur float32
|
||||
Sharpen float32
|
||||
Pixelate int
|
||||
StripMetadata bool
|
||||
StripColorProfile bool
|
||||
AutoRotate bool
|
||||
@@ -603,6 +604,20 @@ func applySharpenOption(po *ProcessingOptions, args []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func applyPixelateOption(po *ProcessingOptions, args []string) error {
|
||||
if len(args) > 1 {
|
||||
return fmt.Errorf("Invalid pixelate arguments: %v", args)
|
||||
}
|
||||
|
||||
if p, err := strconv.Atoi(args[0]); err == nil && p >= 0 {
|
||||
po.Pixelate = p
|
||||
} else {
|
||||
return fmt.Errorf("Invalid pixelate: %s", args[0])
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func applyPresetOption(po *ProcessingOptions, args []string) error {
|
||||
for _, preset := range args {
|
||||
if p, ok := presets[preset]; ok {
|
||||
@@ -806,6 +821,8 @@ func applyURLOption(po *ProcessingOptions, name string, args []string) error {
|
||||
return applyBlurOption(po, args)
|
||||
case "sharpen", "sh":
|
||||
return applySharpenOption(po, args)
|
||||
case "pixelate", "pix":
|
||||
return applyPixelateOption(po, args)
|
||||
case "watermark", "wm":
|
||||
return applyWatermarkOption(po, args)
|
||||
case "strip_metadata", "sm":
|
||||
|
||||
Reference in New Issue
Block a user