mirror of https://gitee.com/answerdev/answer.git
fix(image): support upload jog images
This commit is contained in:
parent
7a6acc5967
commit
541c35e827
|
@ -12,13 +12,15 @@ func IsSupportedImageFile(file io.Reader, ext string) bool {
|
|||
ext = strings.TrimPrefix(ext, ".")
|
||||
var err error
|
||||
switch strings.ToUpper(ext) {
|
||||
case "JPG", "JPEG":
|
||||
case "JPEG":
|
||||
_, err = jpeg.Decode(file)
|
||||
case "PNG":
|
||||
_, err = png.Decode(file)
|
||||
case "ICO":
|
||||
// TODO: There is currently no good Golang library to parse whether the image is in ico format.
|
||||
return true
|
||||
case "JPG":
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue