mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 11:07:40 +08:00
update image.
This commit is contained in:
parent
d4f8583488
commit
1fe17da712
@ -513,6 +513,9 @@ func decodeGroupImageStoreResponse(_ *QQClient, _ uint16, payload []byte) (inter
|
||||
}, nil
|
||||
}
|
||||
if rsp.BoolFileExit {
|
||||
if rsp.MsgImgInfo != nil {
|
||||
return imageUploadResponse{IsExists: true, FileId: rsp.FileId, Width: rsp.MsgImgInfo.FileWidth, Height: rsp.MsgImgInfo.FileHeight}, nil
|
||||
}
|
||||
return imageUploadResponse{IsExists: true, FileId: rsp.Fid}, nil
|
||||
}
|
||||
return imageUploadResponse{
|
||||
|
@ -194,6 +194,8 @@ type (
|
||||
|
||||
IsExists bool
|
||||
FileId int64
|
||||
Width int32
|
||||
Height int32
|
||||
|
||||
ResourceId string
|
||||
UploadKey []byte
|
||||
|
@ -14,6 +14,8 @@ type TextElement struct {
|
||||
type ImageElement struct {
|
||||
Filename string
|
||||
Size int32
|
||||
Width int32
|
||||
Height int32
|
||||
Url string
|
||||
Md5 []byte
|
||||
Data []byte
|
||||
@ -22,6 +24,9 @@ type ImageElement struct {
|
||||
type GroupImageElement struct {
|
||||
ImageId string
|
||||
FileId int64
|
||||
Size int32
|
||||
Width int32
|
||||
Height int32
|
||||
Md5 []byte
|
||||
Url string
|
||||
}
|
||||
@ -119,11 +124,14 @@ func NewImage(data []byte) *ImageElement {
|
||||
}
|
||||
}
|
||||
|
||||
func NewGroupImage(id string, md5 []byte, fid int64) *GroupImageElement {
|
||||
func NewGroupImage(id string, md5 []byte, fid int64, size, width, height int32) *GroupImageElement {
|
||||
return &GroupImageElement{
|
||||
ImageId: id,
|
||||
FileId: fid,
|
||||
Md5: md5,
|
||||
Size: size,
|
||||
Width: width,
|
||||
Height: height,
|
||||
Url: "http://gchat.qpic.cn/gchatpic_new/1/0-0-" + strings.ReplaceAll(id[1:36], "-", "") + "/0?term=2",
|
||||
}
|
||||
}
|
||||
|
@ -294,6 +294,7 @@ func ToProtoElems(elems []IMessageElement, generalFlags bool) (r []*msg.Elem) {
|
||||
CustomFace: &msg.CustomFace{
|
||||
FilePath: e.Filename,
|
||||
Md5: e.Md5,
|
||||
Size: e.Size,
|
||||
Flag: make([]byte, 4),
|
||||
OldData: imgOld,
|
||||
},
|
||||
@ -306,6 +307,7 @@ func ToProtoElems(elems []IMessageElement, generalFlags bool) (r []*msg.Elem) {
|
||||
Origin: 1,
|
||||
FileId: int32(e.FileId),
|
||||
FilePath: e.ImageId,
|
||||
Size: e.Size,
|
||||
Md5: e.Md5[:],
|
||||
Flag: make([]byte, 4),
|
||||
//OldData: imgOld,
|
||||
@ -522,6 +524,8 @@ func ParseMessageElems(elems []*msg.Elem) []IMessageElement {
|
||||
res = append(res, &ImageElement{
|
||||
Filename: elem.CustomFace.FilePath,
|
||||
Size: elem.CustomFace.Size,
|
||||
Width: elem.CustomFace.Width,
|
||||
Height: elem.CustomFace.Height,
|
||||
Url: func() string {
|
||||
if elem.CustomFace.OrigUrl == "" {
|
||||
return "http://gchat.qpic.cn/gchatpic_new/0/0-0-" + strings.ReplaceAll(binary.CalculateImageResourceId(elem.CustomFace.Md5)[1:37], "-", "") + "/0?term=2"
|
||||
|
Loading…
x
Reference in New Issue
Block a user