上传图片测试

This commit is contained in:
苏尹岚
2020-04-01 09:31:53 +08:00
parent 516af09034
commit 4bec1314fa

View File

@@ -80,10 +80,14 @@ func RegisterDataResource(ctx *jxcontext.Context, name, resourceURL, mimeType, h
if err != nil { if err != nil {
return nil, err return nil, err
} }
fmt.Println("test11111111111111111")
img.Bounds().Dx()
if imgType == model.ImgTypeMain { if imgType == model.ImgTypeMain {
fmt.Println("test222222222222222222222")
if img.Bounds().Dx() != MainImgWidth || img.Bounds().Dy() != MainImgHeight { if img.Bounds().Dx() != MainImgWidth || img.Bounds().Dy() != MainImgHeight {
return nil, fmt.Errorf("图片大小:%dx%d非法要求必须:%dx%d", img.Bounds().Dx(), img.Bounds().Dy(), MainImgWidth, MainImgHeight) return nil, fmt.Errorf("图片大小:%dx%d非法要求必须:%dx%d", img.Bounds().Dx(), img.Bounds().Dy(), MainImgWidth, MainImgHeight)
} }
fmt.Println("test33333333333333333333333333")
} }
dataRes = &model.DataResource{ dataRes = &model.DataResource{
Name: name, Name: name,
@@ -92,9 +96,7 @@ func RegisterDataResource(ctx *jxcontext.Context, name, resourceURL, mimeType, h
MainURL: resourceURL, MainURL: resourceURL,
UseType: int8(imgType), UseType: int8(imgType),
} }
fmt.Println("test222222222222222222222")
vendorID := jxutils.GuessDataResourceVendor(resourceURL) vendorID := jxutils.GuessDataResourceVendor(resourceURL)
fmt.Println("test11111111111111111111", vendorID)
switch vendorID { switch vendorID {
case model.VendorIDQiNiuCloud: case model.VendorIDQiNiuCloud:
dataRes.QiniuURL = resourceURL dataRes.QiniuURL = resourceURL