Run runs the given pipeline with the given parameters
( ctx context.Context, img *vips.Image, po ProcessingOptions, imgdata imagedata.ImageData, )
| 73 | |
| 74 | // Run runs the given pipeline with the given parameters |
| 75 | func (p Pipeline) Run( |
| 76 | ctx context.Context, |
| 77 | img *vips.Image, |
| 78 | po ProcessingOptions, |
| 79 | imgdata imagedata.ImageData, |
| 80 | ) error { |
| 81 | pctx := p.newContext(ctx, img, po, imgdata) |
| 82 | pctx.CalcParams() |
| 83 | |
| 84 | for _, step := range p { |
| 85 | if err := step(&pctx); err != nil { |
| 86 | return err |
| 87 | } |
| 88 | |
| 89 | if err := server.CheckTimeout(ctx); err != nil { |
| 90 | return err |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | img.SetDouble("imgproxy-dpr-scale", pctx.DprScale) |
| 95 | |
| 96 | return nil |
| 97 | } |
| 98 | |
| 99 | func (p Pipeline) newContext( |
| 100 | ctx context.Context, |