hyphenate_SDK4.0 5.0.0
hyphenate java IM SDK
 
载入中...
搜索中...
未找到
com.hyphenate.chat.EMImageMessageBody类 参考
类 com.hyphenate.chat.EMImageMessageBody 继承关系图:
com.hyphenate.chat.EMFileMessageBody com.hyphenate.chat.EMMessageBody

Public 成员函数

 EMImageMessageBody (File imageFile)
 
 EMImageMessageBody (Uri imageUri)
 
 EMImageMessageBody (File imageFile, File thumbnailFile)
 
 EMImageMessageBody (Uri imageLocalPath, Uri thumbnailPath)
 
 EMImageMessageBody (EMAImageMessageBody body)
 
boolean isGif ()
 
void setGif (boolean isGif)
 
String getThumbnailUrl ()
 
void setThumbnailUrl (String thumbnailUrl)
 
void setThumbnailSecret (String secret)
 
String getThumbnailSecret ()
 
void setSendOriginalImage (boolean sendOriginalImage)
 
boolean isSendOriginalImage ()
 
boolean isOriginalImage ()
 
int getWidth ()
 
int getHeight ()
 
String getFileName ()
 
String getBigImageRemoteUrl ()
 
String getBigImageLocalUrl ()
 
void setBigImageLocalUrl (String localUrl)
 
Uri getBigImageLocalUri ()
 
void setBigImageLocalUri (Uri localUri)
 
EMDownloadStatus getBigImageDownloadStatus ()
 
void setSize (int width, int height)
 
long getFileSize ()
 
String thumbnailLocalPath ()
 
Uri thumbnailLocalUri ()
 
String thumbnailDisplayName ()
 
void setThumbnailLocalPath (String localPath)
 
void setThumbnailLocalPath (Uri localPath)
 
void setThumbnailSize (int width, int height)
 
EMDownloadStatus thumbnailDownloadStatus ()
 
void setThumbnailDownloadStatus (EMDownloadStatus status)
 
- Public 成员函数 继承自 com.hyphenate.chat.EMFileMessageBody
 EMFileMessageBody (String localPath)
 
 EMFileMessageBody (Uri localPath)
 
void setFileName (String fileName)
 
String getLocalUrl ()
 
void setLocalUrl (String localUrl)
 
Uri getLocalUri ()
 
void setLocalUrl (Uri localUrl)
 
String getRemoteUrl ()
 
void setRemoteUrl (String remoteUrl)
 
void setSecret (String secret)
 
String getSecret ()
 
String displayName ()
 
void setFileLength (long length)
 
EMDownloadStatus downloadStatus ()
 
void setDownloadStatus (EMDownloadStatus status)
 
- Public 成员函数 继承自 com.hyphenate.chat.EMMessageBody
long operationTime ()
 
String operatorId ()
 
int operationCount ()
 

详细描述

图片消息体类。

EMImageMessageBody body = new EMImageMessageBody(imageFile);
EMImageMessageBody(File imageFile)
定义 EMImageMessageBody.java:81

构造及析构函数说明

◆ EMImageMessageBody() [1/5]

com.hyphenate.chat.EMImageMessageBody.EMImageMessageBody ( File imageFile)

用图片文件创建一个图片消息体。 参考:一共有五种图片消息体生成的方式:

要求传入的参数是一个图片文件:

参数
imageFile图片消息体。

◆ EMImageMessageBody() [2/5]

com.hyphenate.chat.EMImageMessageBody.EMImageMessageBody ( Uri imageUri)

传入图片的 URI 创建一个图片消息体。

参数
imageUri图片的 URI。

◆ EMImageMessageBody() [3/5]

com.hyphenate.chat.EMImageMessageBody.EMImageMessageBody ( File imageFile,
File thumbnailFile )

传入图片附件和缩略图文件创建一个图片消息体。

参数
imageFile图片文件。
thumbnailFile缩略图文件。

◆ EMImageMessageBody() [4/5]

com.hyphenate.chat.EMImageMessageBody.EMImageMessageBody ( Uri imageLocalPath,
Uri thumbnailPath )

传入图片附件和缩略图的 URI 创建一个图片消息体。

参数
imageLocalPath图片 URI,即图片的资源标识符。
thumbnailPath缩略图 URI,即缩略图的资源标识符。

◆ EMImageMessageBody() [5/5]

com.hyphenate.chat.EMImageMessageBody.EMImageMessageBody ( EMAImageMessageBody body)

基于 EMAImageMessageBody 类型的实例创建一个图片消息体。

参数
bodyEMAImageMessageBody 类型的实例。

成员函数说明

◆ getBigImageDownloadStatus()

EMDownloadStatus com.hyphenate.chat.EMImageMessageBody.getBigImageDownloadStatus ( )

获取大图的下载状态。

返回
大图的下载状态。

◆ getBigImageLocalUri()

Uri com.hyphenate.chat.EMImageMessageBody.getBigImageLocalUri ( )

获取大图的本地 URI 字符串。

返回
大图的本地 URI 字符串。

◆ getBigImageLocalUrl()

String com.hyphenate.chat.EMImageMessageBody.getBigImageLocalUrl ( )

获取大图的本地路径或 URI 字符串。

返回
大图的本地路径或 URI 字符串。

◆ getBigImageRemoteUrl()

String com.hyphenate.chat.EMImageMessageBody.getBigImageRemoteUrl ( )

获取大图在服务器上的远程地址。

返回
大图的远程地址。

◆ getFileName()

String com.hyphenate.chat.EMImageMessageBody.getFileName ( )

获取图片文件名称。

返回
图片文件名称。

重载 com.hyphenate.chat.EMFileMessageBody .

◆ getFileSize()

long com.hyphenate.chat.EMImageMessageBody.getFileSize ( )

获取图片文件大小。

返回
图片文件大小。

◆ getHeight()

int com.hyphenate.chat.EMImageMessageBody.getHeight ( )

获取图片的高度。

返回
图片的高度。

◆ getThumbnailSecret()

String com.hyphenate.chat.EMImageMessageBody.getThumbnailSecret ( )

获取缩略图的访问密钥。下载缩略图时用户需要提供密钥进行校验。

返回
缩略图的访问密钥。
弃用
已废弃。请用 getSecret() 代替。

◆ getThumbnailUrl()

String com.hyphenate.chat.EMImageMessageBody.getThumbnailUrl ( )

获取缩略图的服务器地址。

如果设置了 EMOptions#setAutoDownloadThumbnail(boolean),接收消息时 SDK 会自动根据 thumbnailRemotePath 下载缩略图,存储到本地。

返回
缩略图的服务器地址。

◆ getWidth()

int com.hyphenate.chat.EMImageMessageBody.getWidth ( )

获取图片的宽度。

返回
图片的宽度。

◆ isGif()

boolean com.hyphenate.chat.EMImageMessageBody.isGif ( )

是否是gif类型图片。

返回
true :是gif类型图片 false :不是gif类型图片。

◆ isOriginalImage()

boolean com.hyphenate.chat.EMImageMessageBody.isOriginalImage ( )

对于发送方:该值表示发送图片时,是否发送原图; 对于接收方:该值表示 {@EMFileMessageBodygetRemoteUrl()} 指向的是原图资源还是发送方压缩过的图片资源。

返回
是否原图。
  • (默认)false:对于发送方:表示发送压缩后的图片,图片压缩规则为最短边不超过720px,质量压缩到 85。 对于接收方:表示{@EMFileMessageBodygetRemoteUrl()}指向的是发送方压缩过的图片资源。
  • true:对于发送方:表示发送原图;对于接收方:表示{@EMFileMessageBodygetRemoteUrl()}指向的是原图资源。

获取是否为原图资源。

发送方:表示发送图片时是否发送原图。 接收方:表示 EMFileMessageBody#getRemoteUrl() 指向的是原图,还是发送方压缩后的图片。

返回
是否为原图。 -(默认)false:发送方:发送大图,即压缩后的图片(压缩规则:最短边不超过 720px,质量压缩至 85)。 接收方:EMFileMessageBody#getRemoteUrl() 指向压缩后的图片资源。

◆ isSendOriginalImage()

boolean com.hyphenate.chat.EMImageMessageBody.isSendOriginalImage ( )

获取发送图片时是否发送原图。

返回
是否发送原图。
  • (默认)false:表示发送缩略图,图片压缩规则为最短边不超过720px,质量压缩到85。
  • true:表示发送原图。
弃用
已废弃。请用 isOriginalImage() 替代.

◆ setBigImageLocalUri()

void com.hyphenate.chat.EMImageMessageBody.setBigImageLocalUri ( Uri localUri)

设置大图的本地 URI 字符串。

参数
localUri大图的本地 URI 字符串。

◆ setBigImageLocalUrl()

void com.hyphenate.chat.EMImageMessageBody.setBigImageLocalUrl ( String localUrl)

设置大图的本地路径或 URI 字符串。

参数
localUrl大图的本地路径或 URI 字符串。

◆ setGif()

void com.hyphenate.chat.EMImageMessageBody.setGif ( boolean isGif)

设置图片是否是Gif类型。

参数
isGiftrue :是gif类型图片 false : 不是gif类型图片。

◆ setSendOriginalImage()

void com.hyphenate.chat.EMImageMessageBody.setSendOriginalImage ( boolean sendOriginalImage)

设置发送图片时是否发送原图。

该设置对 GIF 图片无效,GIF 图片仅支持发送原图。

参数
sendOriginalImage是否发送原图。
  • (默认)false:发送大图,即压缩后的图片(压缩规则:最短边不超过 720px,质量压缩至 85)。
  • true:发送原图。

◆ setSize()

void com.hyphenate.chat.EMImageMessageBody.setSize ( int width,
int height )

设置图片的尺寸。

参数
width图片的宽度(单位为像素)。
height图片的高度(单位为像素)。

◆ setThumbnailDownloadStatus()

void com.hyphenate.chat.EMImageMessageBody.setThumbnailDownloadStatus ( EMDownloadStatus status)

设置本地数据库缩略图的下载状态。

参数
status缩略图的下载状态。

◆ setThumbnailLocalPath() [1/2]

void com.hyphenate.chat.EMImageMessageBody.setThumbnailLocalPath ( String localPath)

设置缩略图的本地路径。

参数
localPath缩略图的本地路径。

◆ setThumbnailLocalPath() [2/2]

void com.hyphenate.chat.EMImageMessageBody.setThumbnailLocalPath ( Uri localPath)

设置缩略图的本地 URI 字符串。

参数
localPath缩略图的本地 URI 字符串。

◆ setThumbnailSecret()

void com.hyphenate.chat.EMImageMessageBody.setThumbnailSecret ( String secret)

设置访问缩略图的密钥。下载缩略图时用户需要提供密钥进行校验。

参数
secret缩略图的访问密钥。
弃用
已废弃。请用 setSecret(String) 代替。

◆ setThumbnailSize()

void com.hyphenate.chat.EMImageMessageBody.setThumbnailSize ( int width,
int height )

设置缩略图的尺寸。

参数
width缩略图的宽度。
height缩略图的高度。

◆ setThumbnailUrl()

void com.hyphenate.chat.EMImageMessageBody.setThumbnailUrl ( String thumbnailUrl)

设置缩略图的服务器路径。

参数
thumbnailUrl缩略图的服务器路径。

◆ thumbnailDisplayName()

String com.hyphenate.chat.EMImageMessageBody.thumbnailDisplayName ( )

获取缩略图的显示名称。

返回
缩略图的显示名称。

◆ thumbnailDownloadStatus()

EMDownloadStatus com.hyphenate.chat.EMImageMessageBody.thumbnailDownloadStatus ( )

获取缩略图的下载状态。

返回
缩略图的下载状态。

◆ thumbnailLocalPath()

String com.hyphenate.chat.EMImageMessageBody.thumbnailLocalPath ( )

获取缩略图的本地路径或 URI 字符串。

返回
缩略图的本地路径或 URI 字符串。

◆ thumbnailLocalUri()

Uri com.hyphenate.chat.EMImageMessageBody.thumbnailLocalUri ( )

获取缩略图的本地 URI 字符串。

返回
缩略图的本地 URI 字符串。

该类的文档由以下文件生成: