Browse SDKs · iOS
Platform
SDKsiOS

Create an image message from a local path

Create an image message from an absolute path with OpenIM iOS SDK.

Copy

Invoke createImageMessageFromFullPath: on OIMMessageInfo to construct an image message from an absolute file path in the local application sandbox. The SDK automatically extracts image dimensions and performs object storage uploads during dispatch:

Parameters

ParameterTypeRequiredDescription
imagePathNSString *YesAbsolute path to the image file within the application sandbox.

Code example

OIMMessageInfo *message =
    [OIMMessageInfo createImageMessageFromFullPath:imageURL.path];

Return value

Returns an initialized OIMMessageInfo model with its content type set to image.

State changes after the call

  1. Local memory instantiation: This method builds an in-memory model without writing to the database or uploading files immediately.
  2. Subsequent dispatch: Call Send a message to initiate built-in media uploading and message dispatch. If the image is already hosted externally, use Create an image message from a URL.