mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-04-26 21:36:24 +02:00
properly resize when one dimension is specified
This commit is contained in:
parent
1db6456329
commit
b4fae2dd5f
1 changed files with 2 additions and 2 deletions
|
|
@ -56,11 +56,11 @@ func Transform(img data.Image, opt *data.Options) (*data.Image, error) {
|
|||
}
|
||||
|
||||
// resize
|
||||
if opt.Width != 0 && opt.Height != 0 {
|
||||
if w != 0 || h != 0 {
|
||||
if opt.Fit {
|
||||
m = imaging.Fit(m, w, h, imaging.Lanczos)
|
||||
} else {
|
||||
if opt.Width == 0 || opt.Height == 0 {
|
||||
if w == 0 || h == 0 {
|
||||
m = imaging.Resize(m, w, h, imaging.Lanczos)
|
||||
} else {
|
||||
m = imaging.Thumbnail(m, w, h, imaging.Lanczos)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue