@header AgoraChatImageMessageBody.h @abstract Image message body class
- Author
- Hyphenate
- Version
- 3.00 The image message body.
You can create an image message body by calling one of the following methods:
-(instancetype)initWithData:displayName:
-(instancetype)initWithData:thumbnailData:
Note: SDK will compress the image based on the attribute compressRatio when delivering the image.
- (instancetype) initWithData: |
|
(NSData *) |
aData |
thumbnailData: |
|
(NSData *) |
aThumbnailData |
|
|
| |
Initializes an image message body instance.
The image receiver will receive object thumbnail that generated based on sender's aData object.
Adjusts thumbnail resolution on Hyphenate console -> "Thumbnail Size" -> width and height. Unit in px. ex. aData resolution 200 x 400 (1:2), thumbnail resolution setting (width x height) 200 x 200, then will generate thumbnail in 100 x 200 ex. aData resolution 600 x 300 (2:1), thumbnail resolution setting (width x height) 200 x 200, then will generate thumbnail in 200 x 100
The image sender can obtain thumbnail from thumbnailLocalPath.
The image receiver will get thumbnail stored under thumbnailRemotePath after a successful download automatically. However, if the automatic downloading failed, use the following method, downloadMessageThumbnail:progress:completion:
- Parameters
-
aData | The original image object in NSData format. |
aThumbnailData | The thumbnail in NSData format. Will not push to server, but only for local usage. |
- Returns
- An image message body instance.
- (CGFloat) compressionRatio |
|
readwritenonatomicassign |
The compression ratio of the image file.
When sending the image message, the SDK compresses the image file according to the value of this parameter. The value range is (0.0, 1.0], and the default value is 0.6. 1.0 means that the SDK does not compress the image file, and 0.6 means that the SDK compresses the file size to 60% of the original. If you set this parameter to a value lower than 0 (included), the SDK uses the default value.