github.com/wgh-/mattermost-server@v4.8.0-rc2+incompatible/model/file.go (about) 1 // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. 2 // See License.txt for license information. 3 4 package model 5 6 import ( 7 "encoding/json" 8 "io" 9 ) 10 11 const ( 12 MaxImageSize = 6048 * 4032 // 24 megapixels, roughly 36MB as a raw image 13 ) 14 15 var ( 16 IMAGE_EXTENSIONS = [5]string{".jpg", ".jpeg", ".gif", ".bmp", ".png"} 17 IMAGE_MIME_TYPES = map[string]string{".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".gif": "image/gif", ".bmp": "image/bmp", ".png": "image/png", ".tiff": "image/tiff"} 18 ) 19 20 type FileUploadResponse struct { 21 FileInfos []*FileInfo `json:"file_infos"` 22 ClientIds []string `json:"client_ids"` 23 } 24 25 func FileUploadResponseFromJson(data io.Reader) *FileUploadResponse { 26 var o *FileUploadResponse 27 json.NewDecoder(data).Decode(&o) 28 return o 29 } 30 31 func (o *FileUploadResponse) ToJson() string { 32 b, _ := json.Marshal(o) 33 return string(b) 34 }