mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
add fallback solution in case image config cannot be decoded #70
This commit is contained in:
parent
b931cdb4f3
commit
b99ac9982c
1 changed files with 6 additions and 3 deletions
|
@ -118,11 +118,14 @@ func (f *File) Register(fileHeader *multipart.FileHeader, scenarioID uint) error
|
|||
|
||||
imageConfig, _, err := image.DecodeConfig(fileContent)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to decode image configuration: Dimensions of image file are not set: %v", err)
|
||||
log.Println("unable to decode image configuration: Dimensions of image file are not set, using default size 512x512, error:", err)
|
||||
f.ImageWidth = 512
|
||||
f.ImageHeight = 512
|
||||
} else {
|
||||
f.ImageHeight = imageConfig.Height
|
||||
f.ImageWidth = imageConfig.Width
|
||||
}
|
||||
|
||||
f.ImageHeight = imageConfig.Height
|
||||
f.ImageWidth = imageConfig.Width
|
||||
} else {
|
||||
return fmt.Errorf("error on setting file reader back to start of file, dimensions not updated: %v", err)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue