Image and GIF Messages
Users can send image messages and GIF messages through the built-in image plugin in Global IM UIKit. The messages will appear in the message list component on the conversation page. By default, the SDK sends messages containing the following message content objects:
- The image message content class is ImageMessage (type identifier:
RC:ImgMsg
) - The GIF message content class is GIFMessage (type identifier:
RC:GIFMsg
)
Limitations
- Only supports sending local images and GIFs.
- The maximum size for an image is 100 MB.
- The maximum size for a GIF is 2 MB. Files exceeding this limit will be sent as file messages.
- The files in image messages and GIF messages can only be uploaded to RC servers and are not supported for uploading to custom server addresses.
Usage
The extension panel comes with a default entry for sending image messages. Users can click the +
button on the left side of the input bar to expand the extension panel, then click the image icon to open the local photo album and select images or GIF files to send.
Customization
Adjusting Image Compression Quality
Before sending, images are compressed in quality, and thumbnails are generated for display in the chat UI. GIFs do not have thumbnails and are not compressed.
- Thumbnails for Image Messages: The SDK generates a large image with 30% quality of the original, conforming to standard size requirements, before uploading and sending. The longest side of the compressed image does not exceed 240 px. The thumbnail is used for display in the chat UI.
- Images: If the original image is not selected for sending, the SDK generates a large image with 85% quality of the original, conforming to standard size requirements, before uploading and sending. The longest side of the compressed image does not exceed 1080 px.
Generally, it is not recommended to modify the SDK's default compression settings. If you need to adjust the SDK's compression quality, refer to the knowledge base document How to Modify the SDK's Default Image and Video Compression Settings.
Customizing the UI for Image and GIF Messages
Image messages and GIF messages are displayed in the message list using the following default templates.
ImageMessageItemProvider
GIFMessageItemProvider
If you need to adjust the built-in message styles, it is recommended to implement your own message display template class and provide this custom template to the SDK. All message templates inherit from BaseMessageItemProvider<CustomMessage>
, and custom message display templates should also inherit from BaseMessageItemProvider<CustomMessage>
. For more details, see Modifying Message Display Styles.