@@ -25,10 +25,6 @@ func testImgForModel(c *Context, model *BaseModel, path string) (result bool) {
|
||||
c.Logger.Errorf("Failed to decode image for model with id %s\nErr:%s", model.Id, err)
|
||||
return
|
||||
}
|
||||
if format != "png" {
|
||||
c.Logger.Errorf("Found unkown format '%s' while testing an image\n", format)
|
||||
return
|
||||
}
|
||||
|
||||
var model_color string
|
||||
|
||||
@@ -36,10 +32,11 @@ func testImgForModel(c *Context, model *BaseModel, path string) (result bool) {
|
||||
width, height := bounds.Max.X, bounds.Max.Y
|
||||
|
||||
switch src.ColorModel() {
|
||||
case color.Gray16Model:
|
||||
fallthrough
|
||||
case color.Gray16Model: fallthrough
|
||||
case color.GrayModel:
|
||||
model_color = "greyscale"
|
||||
case color.YCbCrModel:
|
||||
model_color = "rgb"
|
||||
default:
|
||||
c.Logger.Error("Do not know how to handle this color model")
|
||||
|
||||
@@ -47,8 +44,6 @@ func testImgForModel(c *Context, model *BaseModel, path string) (result bool) {
|
||||
c.Logger.Info("Color is rgb")
|
||||
} else if src.ColorModel() == color.NRGBAModel {
|
||||
c.Logger.Info("Color is nrgb")
|
||||
} else if src.ColorModel() == color.YCbCrModel {
|
||||
c.Logger.Info("Color is ycbcr")
|
||||
} else if src.ColorModel() == color.AlphaModel {
|
||||
c.Logger.Info("Color is alpha")
|
||||
} else if src.ColorModel() == color.CMYKModel {
|
||||
@@ -69,5 +64,10 @@ func testImgForModel(c *Context, model *BaseModel, path string) (result bool) {
|
||||
return
|
||||
}
|
||||
|
||||
if format != model.Format {
|
||||
c.Logger.Warn("Image format does not match model", format, model.Format)
|
||||
return
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user