mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 11:07:40 +08:00
fix height width
This commit is contained in:
parent
0753140ccd
commit
f65eda3c20
@ -7,6 +7,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"image"
|
||||
"io"
|
||||
"math"
|
||||
"math/rand"
|
||||
@ -645,11 +646,12 @@ func (c *QQClient) UploadGroupImage(groupCode int64, img []byte) (*message.Group
|
||||
}
|
||||
return nil, errors.New("upload failed")
|
||||
ok:
|
||||
i, _, _ := image.DecodeConfig(bytes.NewReader(img))
|
||||
var imageType int32 = 1000
|
||||
if bytes.HasPrefix(img, []byte{0x47, 0x49, 0x46, 0x38}) {
|
||||
imageType = 2000
|
||||
}
|
||||
return message.NewGroupImage(binary.CalculateImageResourceId(h[:]), h[:], rsp.FileId, int32(len(img)), rsp.Width, rsp.Height, imageType), nil
|
||||
return message.NewGroupImage(binary.CalculateImageResourceId(h[:]), h[:], rsp.FileId, int32(len(img)), int32(i.Width), int32(i.Height), imageType), nil
|
||||
}
|
||||
|
||||
func (c *QQClient) UploadPrivateImage(target int64, img []byte) (*message.FriendImageElement, error) {
|
||||
|
@ -77,6 +77,8 @@ func (e *GroupImageElement) Pack() (r []*msg.Elem) {
|
||||
Useful: 1,
|
||||
//Origin: 1,
|
||||
BizType: 5,
|
||||
Width: e.Width,
|
||||
Height: e.Height,
|
||||
FileId: int32(e.FileId),
|
||||
FilePath: e.ImageId,
|
||||
ImageType: e.ImageType,
|
||||
|
Loading…
x
Reference in New Issue
Block a user