作者 yangfu

上传修改

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