github.com/vnforks/kid/v5@v5.22.1-0.20200408055009-b89d99c65676/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 = [7]string{".jpg", ".jpeg", ".gif", ".bmp", ".png", ".tiff", "tif"} 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", ".tif": "image/tif"} 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 }