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

Method canScaleOnLoad

processing/scale_on_load.go:12–28  ·  view source on GitHub ↗
(c *Context, shrink float64)

Source from the content-addressed store, hash-verified

10)
11
12func (p *Processor) canScaleOnLoad(c *Context, shrink float64) bool {
13 if c.ImgData == nil || shrink == 1 {
14 return false
15 }
16
17 if c.ImgData.Format().IsVector() {
18 return true
19 }
20
21 if p.config.DisableShrinkOnLoad || shrink <= 1 {
22 return false
23 }
24
25 return c.ImgData.Format() == imagetype.JPEG ||
26 c.ImgData.Format() == imagetype.WEBP ||
27 c.ImgData.Format().SupportsThumbnail()
28}
29
30func calcJpegShink(shrink float64) float64 {
31 switch {

Callers 1

scaleOnLoadMethod · 0.95

Calls 3

IsVectorMethod · 0.80
SupportsThumbnailMethod · 0.80
FormatMethod · 0.65

Tested by

no test coverage detected