1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-01-18 11:12:10 +02:00

Apply dprScale after min width/height

This commit is contained in:
DarthSim 2023-04-18 18:52:20 +03:00
parent c98752651a
commit 9b65b7257d

View File

@ -113,9 +113,6 @@ func calcScale(width, height int, po *options.ProcessingOptions, imgtype imagety
dprScale = math.Min(dprScale, math.Min(wshrink, hshrink)) dprScale = math.Min(dprScale, math.Min(wshrink, hshrink))
} }
wshrink /= dprScale
hshrink /= dprScale
if po.MinWidth > 0 { if po.MinWidth > 0 {
if minShrink := srcW / float64(po.MinWidth); minShrink < wshrink { if minShrink := srcW / float64(po.MinWidth); minShrink < wshrink {
hshrink /= wshrink / minShrink hshrink /= wshrink / minShrink
@ -130,6 +127,9 @@ func calcScale(width, height int, po *options.ProcessingOptions, imgtype imagety
} }
} }
wshrink /= dprScale
hshrink /= dprScale
if wshrink > srcW { if wshrink > srcW {
wshrink = srcW wshrink = srcW
} }