作者 yangfu

上传修改

... ... @@ -109,12 +109,14 @@ func ResizeImage(fileType, sourcePath, prefix, subfix string, file *multipart.Fi
log.Error(err)
return
}
image, err := imaging.Decode(src)
image, err := imaging.Decode(src, imaging.AutoOrientation(true))
if err != nil {
fmt.Println(err)
return
}
image = imaging.Resize(image, 0, 400, imaging.Lanczos)
Rectangle := image.Bounds()
log.Debug(Rectangle.Dx(), Rectangle.Dy())
image = imaging.Resize(image, Rectangle.Dx()/3, 0, imaging.Lanczos)
err = imaging.Save(image, filename)
if err != nil {
log.Error(err)
... ...