Browse SDKs · Android
SDKsAndroid

Create an image message from URLs

Use createImageMessageByURL to create an image message for an uploaded resource.

Copy

Prepare the original, large, and thumbnail PictureInfo values before creating the message.

Parameters

ParameterTypeRequiredDescription
sourceURLStringYesRemote URL of the uploaded original image.
sourcePicturePictureInfoYesURL, dimensions, size, and type of the original image.
bigPicturePictureInfoYesLarge-image data; provide usable image information when no separate large image exists.
snapshotPicturePictureInfoYesThumbnail data used in lists and previews.
Message message = OpenIMClient.getInstance().messageManager.createImageMessageByURL(
    sourceURL, sourcePicture, bigPicture, snapshotPicture);

The returned Message contains metadata for an uploaded image and does not upload the file again. Verify that recipients can access every URL, then use Send an uploaded media message.