其实上图已经定位很准确了,这里再贴下吧:
AVIMImageMessage imageMsg = (AVIMImageMessage) message;
String localFilePath = imageMsg.getLocalFilePath();
int width = imageMsg.getWidth();
int height = imageMsg.getHeight();
在imageMsg.getWidth()这里出问题的。
目前,没办法,只能改成下面的方法获取宽高了:
private int getIntValByKey(AVIMImageMessage imageMsg, String key) {
Map<String, Object> metaData = imageMsg.getFileMetaData();
if (metaData != null && metaData.containsKey(key)) {
Object value = metaData.get(key);
if (value instanceof Integer || value instanceof Long) {
return (int) value;
} else if (value instanceof Double) {
return (int) ((double) value);
}else if(value instanceof BigDecimal){
return ((BigDecimal) value).intValue();
}
}
return 0;
}