SDKsiOS
Create an image message from a URL
Create an image message from a previously uploaded URL with OpenIM iOS SDK.
When the application has already uploaded image assets to object storage and possesses remote URLs, invoke createImageMessageByURL:sourcePicture:bigPicture:snapshotPicture: on OIMMessageInfo to construct an image message object directly without redundant uploads by the SDK:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
sourcePath | NSString * | Yes | Local source path. Pass an empty string @"" when referencing remote resources directly. |
sourcePicture | OIMPictureInfo * | Yes | Original image metadata object containing remote URL, dimensions, and file size. |
bigPicture | OIMPictureInfo * | Yes | High-resolution image metadata object. |
snapshotPicture | OIMPictureInfo * | Yes | Thumbnail image metadata object. |
Code example
OIMMessageInfo *message =
[OIMMessageInfo createImageMessageByURL:@""
sourcePicture:source
bigPicture:big
snapshotPicture:snapshot];Return value
Returns an initialized OIMMessageInfo model populated with the remote image information. The URLs, dimensions, and file sizes across all three OIMPictureInfo objects must represent valid remote assets.
State changes after the call
- Local memory instantiation: This method constructs an in-memory message object without writing to the local database or initiating network requests.
- Subsequent dispatch: Because media assets are already uploaded, deliver the message by calling Send a message without SDK-managed upload. If you want the SDK to handle local file upload automatically, use Create an image message from a local path.
Was this page helpful?