social.plus SDK allows you to create comments with images, providing rich visual communication in conversations. This feature works seamlessly with the SDK’s optimistic creation mechanism, ensuring the same fast and responsive user experience as with text comments.

Image Attachments

Support up to 10 images per comment with various formats

Optimistic Updates

Comments appear instantly while images upload in background

File Management

Automatic file handling with proper validation and limits
Image comments use the same optimistic update mechanism as text comments, displaying immediately in the UI while the SDK handles upload and creation in the background.

Image Requirements

Understanding image requirements ensures successful comment creation and proper moderation.
SpecificationWith Image ModerationWithout Image Moderation
File TypesJPG/JPEG, PNGJPG/JPEG, WebP
Max Images10 images per comment10 images per comment
File Size1 GB per image1 GB per image
Total Size10 GB per comment10 GB per comment

Reference Types

Image comments can be created on different types of content by specifying the appropriate reference type.
Reference TypeDescriptionUse Cases
postImage comments on regular postsPhoto responses, visual feedback
storyImage comments on story contentStory reactions, visual responses
contentImage comments on specialized contentVisual documentation, examples

Implementation Process

Images must be uploaded first before creating the comment. See Image Handling for upload instructions.
1

Prepare Images

Select and validate images according to format and size requirements.
2

Upload Files

Upload images to obtain fileIds for attachment.
3

Create Comment

Use AmityCommentCreateOptions with attachment fileIds.
4

Handle Response

Process the result and update your UI accordingly.

Parameters

ParameterTypeRequiredDescription
referenceIdStringYesID of the content being commented on
referenceTypeEnumYesType of content (.post, .story, .content)
attachments[AmityCommentAttachment]YesArray of image file attachments (max 10)
textStringNoOptional text content alongside images
parentIdStringNoID of parent comment for threaded replies
func createImageComment() async {
    let createOptions = AmityCommentCreateOptions(referenceId: "post-id", referenceType: .post, text: "My image comment", attachments: [.image(fileId: "uploaded-image-id1"), .image(fileId: "uploaded-image-id2")], parentId: nil)
    do {
        let comment = try await commentRepository.createComment(with: createOptions)
    } catch {
        // Handle error here
    }
}

Practical Examples

Visual Feedback

Enable users to provide visual responses with screenshots, diagrams, or photos for better communication.

Product Reviews

Allow customers to share product photos in reviews and comments for authentic feedback and social proof.

Technical Support

Let users share screenshots of issues or error states to help support teams provide better assistance.

Educational Content

Enable students and instructors to share visual examples, diagrams, and educational materials in discussions.