Browse Source

fix

pull/439/head
丁超 9 years ago
parent
commit
520e4a7f76
  1. 7
      weed/images/resizing.go

7
weed/images/resizing.go

@ -19,11 +19,18 @@ func Resized(ext string, data []byte, width, height int) (resized []byte, w int,
dx := srcImage.Bounds().Dx()
dy := srcImage.Bounds().Dy()
if height == 0 {
height = width * dy / dx
} else if width == 0 {
width = height * dx / dy
} else {
if width/height > dx/dy { //定高
width = height * dx / dy
} else if width/height < dx/dy { //定宽
height = width * dy / dx
}
}
if err == nil {
bounds := srcImage.Bounds()

Loading…
Cancel
Save