ChatMessage.createImageSendMessage constructor
~english Creates an image message for sending.
Param targetId
The ID of the message recipient.
- For a one-to-one chat, it is the username of the peer user.
- For a group chat, it is the group ID.
- For a chat room, it is the chat room ID.
Param filePath
The image path.
Param displayName
The image name.
Param thumbnailLocalPath
The local path of the image thumbnail.
Param sendOriginalImage
Whether to send the original image.
true
: Yes.false
: (default) No. For an image greater than 100 KB, the SDK will compress it and send the thumbnail.
Param fileSize
The image file size in bytes.
Param width
The image width in pixels.
Param height
The image height in pixels.
Param chatType
The chat type, default is single chat, if it is group chat or chat room, see ChatType.
Return The message instance. ~end
~chinese 创建一条待发送的图片消息。
Param targetId
消息接收方,可以是:
- 用户:用户 ID;
- 群组:群组 ID;
- 聊天室:聊天室 ID。
Param filePath
文件路径。
Param displayName
图片名。
Param thumbnailLocalPath
缩略图本地路径。
Param sendOriginalImage
是否发送原图。
true
: 是。false
: (default) 否。默认大于 100 kb 的图片会自动压缩发送缩略图。
Param fileSize
图片文件大小,单位是字节。
Param width
图片的宽,单位是像素。
Param height
图片的高,单位是像素。
Param chatType
聊天类型, 默认为单聊,如果是群聊或者聊天室,可以参考ChatType。
Return 图片实例。 ~end
Implementation
ChatMessage.createImageSendMessage({
required String targetId,
required String filePath,
String? displayName,
String? thumbnailLocalPath,
bool sendOriginalImage = false,
int? fileSize,
double? width,
double? height,
ChatType chatType = ChatType.Chat,
}) : this.createSendMessage(
chatType: chatType,
to: targetId,
body: ChatImageMessageBody(
localPath: filePath,
displayName: displayName,
thumbnailLocalPath: thumbnailLocalPath,
sendOriginalImage: sendOriginalImage,
width: width,
height: height,
));