createImageMessageFromFullPath
Feature Introduction
Note
Create an image message. The SDK internally extracts the image information from the full path and creates an image message.
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- React-Native
- Unity
Function Prototype
Future<Message> createImageMessageFromFullPath({
required String imagePath,
String? operationID,
})
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
imagePath | String | Yes | Absolute path |
Return Value
Name | Type | Description |
---|---|---|
~ | Message | Successful return |
Code Example
Message msg = await OpenIM.iMManager.messageManager.createImageMessageFromFullPath(imagePath: imagePath);
//todo
Function Prototype
+ (OIMMessageInfo *)createImageMessageFromFullPath:(NSString *)imagePath;
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
imagePath | NSString | Yes | Absolute path |
Return Value
Name | Type | Description |
---|---|---|
message | OIMMessageInfo | Successful return |
Code Example
OIMMessageInfo *message = [OIMMessageInfo createImageMessageFromFullPath:@""];
Function Prototype
public Message createImageMessageFromFullPath(String imagePath)
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
imagePath | String | Yes | Absolute path |
Return Value
Name | Type | Description |
---|---|---|
~ | Message | Successful return |
Code Example
Message Message= OpenIMClient.getInstance().messageManager.createImageMessageFromFullPath(imagePath);
//todo
Warning
For the Web platform, it is recommended to use createImageMessageByURL or createImageMessageByFile.
Function Prototype
IMSDK.asyncApi('createImageMessageFromFullPath', operationID: string, imagePath: string): Promise<MessageItem>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
operationID | string | Yes | Operation ID, used for problem tracking. It's recommended to use the current time combined with a random number |
imagePath | number | Yes | Image absolute path |
Return Value
The function is Promise-wrapped using the
openim-uniapp-polyfill
package. When calling, you need to usethen
andcatch
to determine and handle successful and failed callbacks.
Name | Type | Description |
---|---|---|
Promise.then() | Promise<MessageItem> | Successful callback |
Promise.catch() | Promise<CatchResponse> | Failed callback |
Code Example
import IMSDK from 'openim-uniapp-polyfill';
IMSDK.asyncApi('createImageMessageFromFullPath', IMSDK.uuid(), 'imagePath')
.then((data) => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});
Function Prototype
OpenIMSDKRN.createImageMessageFromFullPath(imagePath: string, operationID: string): Promise<MessageItem>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
operationID | string | Yes | Operation ID, used for problem location, keep unique, suggest using current time and random number |
imagePath | string | Yes | Image absolute path |
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<MessageItem> | Callback on successful call |
Promise.catch() | Promise<CatchResponse> | Callback on failed call |
Code Example
import OpenIMSDKRN from "open-im-sdk-rn";
OpenIMSDKRN.createImageMessageFromFullPath('imagePath', 'operationID')
.then((data) => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});
Function Prototype
public static Message CreateImageMessageFromFullPath(string imageFullPath)
Input Parameter
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
imageFullPath | string | Yes | Image absolute path |
Return Result
Parameter Name | Type | Description |
---|---|---|
~ | Message | Message Struct |
Code Example
var msg = IMSDK.CreateImageMessageFromFullPath(imageFullPath);