model

package
v0.85.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

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"}
)

Functions

func CheckFilePart

func CheckFilePart(filePart int32) (err error)

CheckFilePart FILE_PART_INVALID: The file part number is invalid. The value is not between 0 and 2,999.

func CheckFilePartSize

func CheckFilePartSize(partSize int32) (err error)

CheckFilePartSize FILE_PART_SIZE_INVALID - 512KB cannot be evenly divided by part_size

func CheckFileParts

func CheckFileParts(fileParts int32) (err error)

CheckFileParts FILE_PARTS_INVALID - Invalid number of parts. The value is not between 1..3000

func GetFileExtName

func GetFileExtName(filePath string) string

func GetImageMimeType

func GetImageMimeType(ext string) string

func GetMimeTypeByStorageFileTyp

func GetMimeTypeByStorageFileTyp(t *mtproto.Storage_FileType) string

func GetSizeLocalIdByType

func GetSizeLocalIdByType(t string) int

func GetSizeTypeByLocalId

func GetSizeTypeByLocalId(localId int) string

func GetStorageFileTypeConstructor

func GetStorageFileTypeConstructor(extName string) int32

func IsFileExtImage

func IsFileExtImage(ext string) bool

func LocalIdIsVideo

func LocalIdIsVideo(localId int) bool

func MakeStorageFileType

func MakeStorageFileType(c int32) *mtproto.Storage_FileType

func PhotoSizeIsVideo

func PhotoSizeIsVideo(t string) bool

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

type ReSizeInfo struct {
	LocalId int
	Type    string
	Size    int
}

func GetMaxResizeInfo

func GetMaxResizeInfo(isABC bool, w, h int) *ReSizeInfo

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL