图片消息体类。
| com.hyphenate.chat.EMImageMessageBody.EMImageMessageBody | ( | File | imageFile | ) |
用图片文件创建一个图片消息体。 参考:一共有五种图片消息体生成的方式:
要求传入的参数是一个图片文件:
EMAImageMessageBody 类型的实例:| imageFile | 图片消息体。 |
| com.hyphenate.chat.EMImageMessageBody.EMImageMessageBody | ( | Uri | imageUri | ) |
传入图片的 URI 创建一个图片消息体。
| imageUri | 图片的 URI。 |
| com.hyphenate.chat.EMImageMessageBody.EMImageMessageBody | ( | File | imageFile, |
| File | thumbnailFile ) |
传入图片附件和缩略图文件创建一个图片消息体。
| imageFile | 图片文件。 |
| thumbnailFile | 缩略图文件。 |
| com.hyphenate.chat.EMImageMessageBody.EMImageMessageBody | ( | Uri | imageLocalPath, |
| Uri | thumbnailPath ) |
传入图片附件和缩略图的 URI 创建一个图片消息体。
| imageLocalPath | 图片 URI,即图片的资源标识符。 |
| thumbnailPath | 缩略图 URI,即缩略图的资源标识符。 |
| com.hyphenate.chat.EMImageMessageBody.EMImageMessageBody | ( | EMAImageMessageBody | body | ) |
基于 EMAImageMessageBody 类型的实例创建一个图片消息体。
| body | EMAImageMessageBody 类型的实例。 |
| EMDownloadStatus com.hyphenate.chat.EMImageMessageBody.getBigImageDownloadStatus | ( | ) |
获取大图的下载状态。
| Uri com.hyphenate.chat.EMImageMessageBody.getBigImageLocalUri | ( | ) |
获取大图的本地 URI 字符串。
| String com.hyphenate.chat.EMImageMessageBody.getBigImageLocalUrl | ( | ) |
获取大图的本地路径或 URI 字符串。
| String com.hyphenate.chat.EMImageMessageBody.getBigImageRemoteUrl | ( | ) |
获取大图在服务器上的远程地址。
| String com.hyphenate.chat.EMImageMessageBody.getFileName | ( | ) |
| long com.hyphenate.chat.EMImageMessageBody.getFileSize | ( | ) |
获取图片文件大小。
| int com.hyphenate.chat.EMImageMessageBody.getHeight | ( | ) |
获取图片的高度。
| String com.hyphenate.chat.EMImageMessageBody.getThumbnailSecret | ( | ) |
| String com.hyphenate.chat.EMImageMessageBody.getThumbnailUrl | ( | ) |
获取缩略图的服务器地址。
如果设置了 EMOptions#setAutoDownloadThumbnail(boolean),接收消息时 SDK 会自动根据 thumbnailRemotePath 下载缩略图,存储到本地。
| int com.hyphenate.chat.EMImageMessageBody.getWidth | ( | ) |
获取图片的宽度。
| boolean com.hyphenate.chat.EMImageMessageBody.isGif | ( | ) |
是否是gif类型图片。
| boolean com.hyphenate.chat.EMImageMessageBody.isOriginalImage | ( | ) |
对于发送方:该值表示发送图片时,是否发送原图; 对于接收方:该值表示 {@EMFileMessageBodygetRemoteUrl()} 指向的是原图资源还是发送方压缩过的图片资源。
false:对于发送方:表示发送压缩后的图片,图片压缩规则为最短边不超过720px,质量压缩到 85。 对于接收方:表示{@EMFileMessageBodygetRemoteUrl()}指向的是发送方压缩过的图片资源。true:对于发送方:表示发送原图;对于接收方:表示{@EMFileMessageBodygetRemoteUrl()}指向的是原图资源。获取是否为原图资源。
发送方:表示发送图片时是否发送原图。 接收方:表示 EMFileMessageBody#getRemoteUrl() 指向的是原图,还是发送方压缩后的图片。
false:发送方:发送大图,即压缩后的图片(压缩规则:最短边不超过 720px,质量压缩至 85)。 接收方:EMFileMessageBody#getRemoteUrl() 指向压缩后的图片资源。true:发送方:发送原图。 接收方:EMFileMessageBody#getRemoteUrl() 指向原图资源。 | boolean com.hyphenate.chat.EMImageMessageBody.isSendOriginalImage | ( | ) |
获取发送图片时是否发送原图。
false:表示发送缩略图,图片压缩规则为最短边不超过720px,质量压缩到85。true:表示发送原图。 isOriginalImage() 替代.| void com.hyphenate.chat.EMImageMessageBody.setBigImageLocalUri | ( | Uri | localUri | ) |
设置大图的本地 URI 字符串。
| localUri | 大图的本地 URI 字符串。 |
| void com.hyphenate.chat.EMImageMessageBody.setBigImageLocalUrl | ( | String | localUrl | ) |
设置大图的本地路径或 URI 字符串。
| localUrl | 大图的本地路径或 URI 字符串。 |
| void com.hyphenate.chat.EMImageMessageBody.setGif | ( | boolean | isGif | ) |
设置图片是否是Gif类型。
| isGif | true :是gif类型图片 false : 不是gif类型图片。 |
| void com.hyphenate.chat.EMImageMessageBody.setSendOriginalImage | ( | boolean | sendOriginalImage | ) |
设置发送图片时是否发送原图。
该设置对 GIF 图片无效,GIF 图片仅支持发送原图。
| sendOriginalImage | 是否发送原图。
|
| void com.hyphenate.chat.EMImageMessageBody.setSize | ( | int | width, |
| int | height ) |
设置图片的尺寸。
| width | 图片的宽度(单位为像素)。 |
| height | 图片的高度(单位为像素)。 |
| void com.hyphenate.chat.EMImageMessageBody.setThumbnailDownloadStatus | ( | EMDownloadStatus | status | ) |
设置本地数据库缩略图的下载状态。
| status | 缩略图的下载状态。 |
| void com.hyphenate.chat.EMImageMessageBody.setThumbnailLocalPath | ( | String | localPath | ) |
设置缩略图的本地路径。
| localPath | 缩略图的本地路径。 |
| void com.hyphenate.chat.EMImageMessageBody.setThumbnailLocalPath | ( | Uri | localPath | ) |
设置缩略图的本地 URI 字符串。
| localPath | 缩略图的本地 URI 字符串。 |
| void com.hyphenate.chat.EMImageMessageBody.setThumbnailSecret | ( | String | secret | ) |
| void com.hyphenate.chat.EMImageMessageBody.setThumbnailSize | ( | int | width, |
| int | height ) |
设置缩略图的尺寸。
| width | 缩略图的宽度。 |
| height | 缩略图的高度。 |
| void com.hyphenate.chat.EMImageMessageBody.setThumbnailUrl | ( | String | thumbnailUrl | ) |
设置缩略图的服务器路径。
| thumbnailUrl | 缩略图的服务器路径。 |
| String com.hyphenate.chat.EMImageMessageBody.thumbnailDisplayName | ( | ) |
获取缩略图的显示名称。
| EMDownloadStatus com.hyphenate.chat.EMImageMessageBody.thumbnailDownloadStatus | ( | ) |
获取缩略图的下载状态。
| String com.hyphenate.chat.EMImageMessageBody.thumbnailLocalPath | ( | ) |
获取缩略图的本地路径或 URI 字符串。
| Uri com.hyphenate.chat.EMImageMessageBody.thumbnailLocalUri | ( | ) |
获取缩略图的本地 URI 字符串。