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.Specification | With Image Moderation | Without Image Moderation |
---|---|---|
File Types | JPG/JPEG, PNG | JPG/JPEG, WebP |
Max Images | 10 images per comment | 10 images per comment |
File Size | 1 GB per image | 1 GB per image |
Total Size | 10 GB per comment | 10 GB per comment |
Reference Types
Image comments can be created on different types of content by specifying the appropriate reference type.Reference Type | Description | Use Cases |
---|---|---|
post | Image comments on regular posts | Photo responses, visual feedback |
story | Image comments on story content | Story reactions, visual responses |
content | Image comments on specialized content | Visual 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
Parameter | Type | Required | Description |
---|---|---|---|
referenceId | String | Yes | ID of the content being commented on |
referenceType | Enum | Yes | Type of content (.post, .story, .content) |
attachments | [AmityCommentAttachment] | Yes | Array of image file attachments (max 10) |
text | String | No | Optional text content alongside images |
parentId | String | No | ID of parent comment for threaded replies |
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.