github.com/gigforks/mattermost-server@v4.9.1-0.20180619094218-800d97fa55d0+incompatible/app/brand.go (about) 1 // Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. 2 // See License.txt for license information. 3 4 package app 5 6 import ( 7 "mime/multipart" 8 "net/http" 9 10 "github.com/mattermost/mattermost-server/model" 11 ) 12 13 func (a *App) SaveBrandImage(imageData *multipart.FileHeader) *model.AppError { 14 if len(*a.Config().FileSettings.DriverName) == 0 { 15 return model.NewAppError("SaveBrandImage", "api.admin.upload_brand_image.storage.app_error", nil, "", http.StatusNotImplemented) 16 } 17 18 if a.Brand == nil { 19 return model.NewAppError("SaveBrandImage", "api.admin.upload_brand_image.not_available.app_error", nil, "", http.StatusNotImplemented) 20 } 21 22 if err := a.Brand.SaveBrandImage(imageData); err != nil { 23 return err 24 } 25 26 return nil 27 } 28 29 func (a *App) GetBrandImage() ([]byte, *model.AppError) { 30 if len(*a.Config().FileSettings.DriverName) == 0 { 31 return nil, model.NewAppError("GetBrandImage", "api.admin.get_brand_image.storage.app_error", nil, "", http.StatusNotImplemented) 32 } 33 34 if a.Brand == nil { 35 return nil, model.NewAppError("GetBrandImage", "api.admin.get_brand_image.not_available.app_error", nil, "", http.StatusNotImplemented) 36 } 37 38 if img, err := a.Brand.GetBrandImage(); err != nil { 39 return nil, err 40 } else { 41 return img, nil 42 } 43 }