MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / applySizeOption

Method applySizeOption

options/parser/apply.go:46–76  ·  view source on GitHub ↗
(ctx context.Context, o *options.Options, args []string)

Source from the content-addressed store, hash-verified

44}
45
46func (p *Parser) applySizeOption(ctx context.Context, o *options.Options, args []string) (err error) {
47 if err = p.ensureMaxArgs(ctx, "size", args, 7); err != nil {
48 return
49 }
50
51 if len(args) >= 1 && len(args[0]) > 0 {
52 if err = p.applyWidthOption(ctx, o, args[0:1]); err != nil {
53 return
54 }
55 }
56
57 if len(args) >= 2 && len(args[1]) > 0 {
58 if err = p.applyHeightOption(ctx, o, args[1:2]); err != nil {
59 return
60 }
61 }
62
63 if len(args) >= 3 && len(args[2]) > 0 {
64 if err = p.applyEnlargeOption(ctx, o, args[2:3]); err != nil {
65 return
66 }
67 }
68
69 if len(args) >= 4 && len(args[3]) > 0 {
70 if err = p.applyExtendOption(ctx, o, args[3:]); err != nil {
71 return
72 }
73 }
74
75 return nil
76}
77
78func (p *Parser) applyResizingTypeOption(ctx context.Context, o *options.Options, args []string) error {
79 return parseFromMap(ctx, p, o, keys.ResizingType, processing.ResizeTypes, args...)

Callers 2

applyResizeOptionMethod · 0.95
applyURLOptionMethod · 0.95

Calls 5

ensureMaxArgsMethod · 0.95
applyWidthOptionMethod · 0.95
applyHeightOptionMethod · 0.95
applyEnlargeOptionMethod · 0.95
applyExtendOptionMethod · 0.95

Tested by

no test coverage detected