0
Fork 0
mirror of https://github.com/willnorris/imageproxy.git synced 2024-12-16 21:56:43 -05:00

remove early bail out in image trasform

This commit is contained in:
Will Norris 2013-12-06 22:28:53 -08:00
parent a0d0260f5e
commit b9584c18cb

View file

@ -36,13 +36,6 @@ func Transform(img data.Image, opt *data.Options) (*data.Image, error) {
return &img, nil
}
if opt.Width == 0 && opt.Height == 0 {
// TODO(willnorris): Currently, only resize related options are
// supported, so bail if no sizes are specified. Remove this
// check if we ever support non-resizing transformations.
return &img, nil
}
// decode image
m, format, err := image.Decode(bytes.NewReader(img.Bytes))
if err != nil {
@ -63,6 +56,7 @@ func Transform(img data.Image, opt *data.Options) (*data.Image, error) {
}
// resize
if opt.Width != 0 && opt.Height != 0 {
if opt.Fit {
m = imaging.Fit(m, w, h, imaging.Lanczos)
} else {
@ -72,6 +66,7 @@ func Transform(img data.Image, opt *data.Options) (*data.Image, error) {
m = imaging.Thumbnail(m, w, h, imaging.Lanczos)
}
}
}
// flip
if opt.FlipVertical {