1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2024-11-24 08:12:38 +02:00

DPR does not enlarge image unless enlarge is true

This commit is contained in:
DarthSim 2021-10-11 18:49:06 +06:00
parent da10f3eac3
commit b27f0d5712
2 changed files with 6 additions and 3 deletions

View File

@ -1,6 +1,9 @@
# Changelog
## [Unreleased]
### Change
- `dpr` processing option doesn't enlarge image unless `enlarge` is true.
### Fix
- Fix Client Hints behavior. `Width` is physical size, so we should divide it by `DPR` value.

View File

@ -67,6 +67,9 @@ func calcScale(width, height int, po *options.ProcessingOptions, imgtype imagety
hshrink = srcH / dstH
}
wshrink /= po.Dpr
hshrink /= po.Dpr
if wshrink != 1 || hshrink != 1 {
rt := po.ResizingType
@ -120,9 +123,6 @@ func calcScale(width, height int, po *options.ProcessingOptions, imgtype imagety
}
}
wshrink /= po.Dpr
hshrink /= po.Dpr
if wshrink > srcW {
wshrink = srcW
}