Documentation
¶
Index ¶
- Constants
- Variables
- func CheckFilePart(filePart int32) (err error)
- func CheckFilePartSize(partSize int32) (err error)
- func CheckFileParts(fileParts int32) (err error)
- func GetFileExtName(filePath string) string
- func GetImageMimeType(ext string) string
- func GetMimeTypeByStorageFileTyp(t *mtproto.Storage_FileType) string
- func GetSizeLocalIdByType(t string) int
- func GetSizeTypeByLocalId(localId int) string
- func GetStorageFileTypeConstructor(extName string) int32
- func IsFileExtImage(ext string) bool
- func LocalIdIsVideo(localId int) bool
- func MakeStorageFileType(c int32) *mtproto.Storage_FileType
- func PhotoSizeIsVideo(t string) bool
- type DfsFileInfo
- type DfsHttpFileInfo
- type ReSizeInfo
Constants ¶
View Source
const ( PhotoSZOriginalSize = 0 // client upload original photo PhotoSZSmallSize = 90 PhotoSZMediumSize = 320 PhotoSZXLargeSize = 800 PhotoSZYLargeSize = 1280 PhotoSZASize = 160 PhotoSZBSize = 320 PhotoSZCSize = 640 PhotoSZStrippedSize = 40 PhotoSZUSize = 320 PhotoSZVSize = 800 )
View Source
const ( PhotoSZOriginalType = "0" // client upload original photo PhotoSZSmallType = "s" PhotoSZMediumType = "m" PhotoSZXLargeType = "x" PhotoSZYLargeType = "y" PhotoSZAType = "a" PhotoSZBType = "b" PhotoSZCType = "c" PhotoSZStrippedType = "i" VideoSZUType = "u" VideoSZVType = "v" )
View Source
const ( PhotoSZOriginalLocalId = 0 // client upload original photo PhotoSZSmallLocalId = 1 PhotoSZMediumLocalId = 2 PhotoSZXLargeLocalId = 3 PhotoSZYLargeLocalId = 4 PhotoSZALocalId = 5 PhotoSZBLocalId = 6 PhotoSZCLocalId = 7 PhotoSZStrippedLocalId = 8 VideoSZULocalId = 9 VideoSZVLocalId = 10 )
Variables ¶
View Source
var ( ImageExtensions = [5]string{".jpg", ".jpeg", ".gif", ".bmp", ".png"} ImageMimeTypes = map[string]string{".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".gif": "image/gif", ".bmp": "image/bmp", ".png": "image/png", ".tiff": "image/tiff"} )
View Source
var ( ReSizeInfoABCList = []ReSizeInfo{ {PhotoSZALocalId, PhotoSZAType, PhotoSZASize}, {PhotoSZBLocalId, PhotoSZBType, PhotoSZBSize}, {PhotoSZCLocalId, PhotoSZCType, PhotoSZCSize}, } ReSizeInfoPhotoList = []ReSizeInfo{ {PhotoSZSmallLocalId, PhotoSZSmallType, PhotoSZSmallSize}, {PhotoSZMediumLocalId, PhotoSZMediumType, PhotoSZMediumSize}, {PhotoSZXLargeLocalId, PhotoSZXLargeType, PhotoSZXLargeSize}, {PhotoSZYLargeLocalId, PhotoSZYLargeType, PhotoSZYLargeSize}, } )
Functions ¶
func CheckFilePart ¶
CheckFilePart FILE_PART_INVALID: The file part number is invalid. The value is not between 0 and 2,999.
func CheckFilePartSize ¶
CheckFilePartSize FILE_PART_SIZE_INVALID - 512KB cannot be evenly divided by part_size
func CheckFileParts ¶
CheckFileParts FILE_PARTS_INVALID - Invalid number of parts. The value is not between 1..3000
func GetFileExtName ¶
func GetImageMimeType ¶
func GetMimeTypeByStorageFileTyp ¶
func GetMimeTypeByStorageFileTyp(t *mtproto.Storage_FileType) string
func GetSizeLocalIdByType ¶
func GetSizeTypeByLocalId ¶
func IsFileExtImage ¶
func LocalIdIsVideo ¶
func MakeStorageFileType ¶
func MakeStorageFileType(c int32) *mtproto.Storage_FileType
func PhotoSizeIsVideo ¶
Types ¶
type DfsFileInfo ¶
type DfsFileInfo struct { Creator int64 `json:"creator"` FileId int64 `json:"file_id"` Big bool `json:"big"` FileName string `json:"file_name"` FileTotalParts int `json:"file_total_parts"` FirstFilePartSize int `json:"first_file_part_size"` FilePartSize int `json:"file_part_size"` LastFilePartSize int `json:"last_file_part_size"` MimeType string `json:"mime_type"` Mtime int64 `json:"mtime"` }
func (*DfsFileInfo) GetFileSize ¶
func (m *DfsFileInfo) GetFileSize() int64
func (*DfsFileInfo) ToArgs ¶
func (m *DfsFileInfo) ToArgs() map[string]string
type DfsHttpFileInfo ¶
type DfsHttpFileInfo struct { io.ReadSeeker Name string Modtime time.Time }
type ReSizeInfo ¶
func GetMaxResizeInfo ¶
func GetMaxResizeInfo(isABC bool, w, h int) *ReSizeInfo
Click to show internal directories.
Click to hide internal directories.