mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-02-07 11:36:25 +02:00
Add resizing_type processing option
This commit is contained in:
parent
9e131b9b79
commit
4f8bae755b
@ -203,9 +203,9 @@ func applySizeOption(po *processingOptions, args []string) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
func applyResizeOption(po *processingOptions, args []string) error {
|
||||
if len(args) > 4 {
|
||||
return fmt.Errorf("Invalid resize arguments: %v", args)
|
||||
func applyResizingTypeOption(po *processingOptions, args []string) error {
|
||||
if len(args) > 1 {
|
||||
return fmt.Errorf("Invalid resizing type arguments: %v", args)
|
||||
}
|
||||
|
||||
if r, ok := resizeTypes[args[0]]; ok {
|
||||
@ -214,6 +214,20 @@ func applyResizeOption(po *processingOptions, args []string) error {
|
||||
return fmt.Errorf("Invalid resize type: %s", args[0])
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func applyResizeOption(po *processingOptions, args []string) error {
|
||||
if len(args) > 4 {
|
||||
return fmt.Errorf("Invalid resize arguments: %v", args)
|
||||
}
|
||||
|
||||
if len(args[0]) > 0 {
|
||||
if err := applyResizingTypeOption(po, args[0:1]); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if len(args) > 1 {
|
||||
if err := applySizeOption(po, args[1:]); err != nil {
|
||||
return err
|
||||
@ -356,6 +370,10 @@ func applyProcessingOption(po *processingOptions, name string, args []string) er
|
||||
if err := applyResizeOption(po, args); err != nil {
|
||||
return err
|
||||
}
|
||||
case "resizing_type":
|
||||
if err := applyResizingTypeOption(po, args); err != nil {
|
||||
return err
|
||||
}
|
||||
case "size":
|
||||
if err := applySizeOption(po, args); err != nil {
|
||||
return err
|
||||
|
Loading…
x
Reference in New Issue
Block a user