loadFilterImage runs the imagor pipeline for an image() filter using the image cache. Bypasses cache for unknown size, exceeds max dims, or requests that depend on original-space coordinates or per-request decode parameters (crop, focal, page, dpi).
( ctx context.Context, blob *imagor.Blob, params imagorpath.Params, load imagor.LoadFunc, url string, )
| 71 | // Bypasses cache for unknown size, exceeds max dims, or requests that depend on |
| 72 | // original-space coordinates or per-request decode parameters (crop, focal, page, dpi). |
| 73 | func (v *Processor) loadFilterImage( |
| 74 | ctx context.Context, blob *imagor.Blob, params imagorpath.Params, load imagor.LoadFunc, |
| 75 | url string, |
| 76 | ) (*vips.Image, error) { |
| 77 | sizeKnown := params.Width > 0 && params.Height > 0 |
| 78 | |
| 79 | if v.cache == nil || blob == nil || !sizeKnown || imagorpath.HasCacheBypass(params) || |
| 80 | params.Width > v.CacheMaxWidth || params.Height > v.CacheMaxHeight { |
| 81 | return v.loadAndProcess(ctx, blob, params, load) |
| 82 | } |
| 83 | |
| 84 | memBlob, origBlob, err := v.loadOrCache(blob, url, 1, nil) |
| 85 | if err != nil { |
| 86 | return nil, err |
| 87 | } |
| 88 | |
| 89 | if origBlob != nil || memBlob == nil { |
| 90 | // Animated source or cache miss — run pipeline on original blob. |
| 91 | return v.loadAndProcess(ctx, blob, params, load) |
| 92 | } |
| 93 | return v.loadAndProcess(ctx, memBlob, params, load) |
| 94 | } |
| 95 | |
| 96 | // fullDimRegex matches a single dimension token: optionally a flip prefix -, |
| 97 | // then f or full, optionally followed by a negative integer offset |