photo

package
Version: v0.0.0-...-6e21e7b Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PHOTO_SIZE_ORIGINAL     = "0" // client upload original photo
	PHOTO_SIZE_SMALL_TYPE   = "s"
	PHOTO_SIZE_MEDIUMN_TYPE = "m"
	PHOTO_SIZE_XLARGE_TYPE  = "x"
	PHOTO_SIZE_YLARGE_TYPE  = "y"
	PHOTO_SIZE_A_TYPE       = "a"
	PHOTO_SIZE_B_TYPE       = "b"
	PHOTO_SIZE_C_TYPE       = "c"

	PHOTO_SIZE_SMALL_SIZE   = 90
	PHOTO_SIZE_MEDIUMN_SIZE = 320
	PHOTO_SIZE_XLARGE_SIZE  = 800
	PHOTO_SIZE_YLARGE_SIZE  = 1280
	PHOTO_SIZE_A_SIZE       = 160
	PHOTO_SIZE_B_SIZE       = 320
	PHOTO_SIZE_C_SIZE       = 640
)

Variables

This section is empty.

Functions

func GetPhotoFileData

func GetPhotoFileData(volumeId int64, localId int32, secret int64, offset int32, limit int32) (*mtproto.Upload_File, error)

func GetPhotoSizeList

func GetPhotoSizeList(photoId int64) (sizes []*mtproto.PhotoSize)

//////////////////////////////////////////////////////////////////////////

func MakeChatPhoto

func MakeChatPhoto(sizes []*mtproto.PhotoSize) *mtproto.ChatPhoto

func MakeUserProfilePhoto

func MakeUserProfilePhoto(photoId int64, sizes []*mtproto.PhotoSize) *mtproto.UserProfilePhoto

func UploadPhotoFile

func UploadPhotoFile(photoId, accessHash int64, filePath, extName string, isABC bool) ([]*mtproto.PhotoSize, error)

TODO(@benqi):

	我们未来的图片存储系统可能会按facebook的Haystack论文来实现
	mtproto协议也定义了一套自己的文件存储方案,fileLocation#53d69076 dc_id:int volume_id:long local_id:int secret:long = FileLocation;
	在这里,我们重新定义mtproto的volume_id和local_id,对应Haystack的key和alternate_key,secret对应cookie
 在当前简单实现里,volume_id由sonwflake生成,local_id对应于图片类型,secret为access_hash

TODO(@benqi):

参数使用mtproto.File

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL