|
|
@@ -3,7 +3,6 @@ package http
|
|
|
import (
|
|
|
"bytes"
|
|
|
json2 "encoding/json"
|
|
|
- "fmt"
|
|
|
"image"
|
|
|
"io/ioutil"
|
|
|
"net/http"
|
|
|
@@ -22,6 +21,9 @@ import (
|
|
|
"git.ikuban.com/server/kratos-utils/http/binding"
|
|
|
"git.ikuban.com/server/kratos-utils/http/encoding/json"
|
|
|
_ "github.com/go-kratos/kratos/v2/encoding/proto"
|
|
|
+ _ "image/gif"
|
|
|
+ _ "image/jpeg"
|
|
|
+ _ "image/png"
|
|
|
)
|
|
|
|
|
|
// decodeRequest decodes the request body to object.
|
|
|
@@ -67,19 +69,14 @@ func parseForm(req *http.Request, v interface{}) error {
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
|
- fmt.Println("70")
|
|
|
- img, _name, _err := image.Decode(f)
|
|
|
- fmt.Printf("72 %v \n %v \n %v\n", img, _name, _err)
|
|
|
- if _err == nil {
|
|
|
|
|
|
+ if img, _, _err := image.Decode(f); _err == nil {
|
|
|
value[k1+"Height"] = img.Bounds().Max.Y
|
|
|
value[k1+"Wide"] = img.Bounds().Max.X
|
|
|
}
|
|
|
- fmt.Println("75")
|
|
|
value[k1] = buf.Bytes()
|
|
|
value[k1+"Filename"] = v1[0].Filename
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
if req.MultipartForm.Value != nil {
|
|
|
for k1, v1 := range req.MultipartForm.Value {
|