Skip to main content
Share visual content with support for multiple images, captions, and metadata. Image posts support up to 10 images per post with rich text descriptions.

Multiple Images

Upload up to 10 images per post with individual reactions

Rich Media Support

JPEG, PNG, WebP formats up to 100MB per image

Overview

Image posts combine visual content with descriptive text:
  • Multiple Images: Up to 10 images per post
  • Rich Captions: Text descriptions with mentions and hashtags
  • Parent-Child Structure: Each image becomes a child post
  • Interactive Features: Users can react to individual images
  • Structure Type: Pure image posts have structureType = "image"
RequirementLimitNotes
File SizeUp to 100MB per imagePlatform may have lower limits
Image CountMaximum 10 imagesPer single post
File FormatsJPEG, PNG, WebP, etc.Platform dependent
Want to mix media types? Combine images with videos, audio, or files in a single post using Mixed Media Posts. Mixed posts allow up to 10 attachments of any combination.
Images must be uploaded first before creating the post. See Image Handling for upload instructions.
1

Upload Images

Use the File Repository to upload your images and get file IDs
2

Create Post

Use the file IDs in your post creation request
3

Handle Response

The post will contain parent and child posts for each image

Parameters

ParameterTypeRequiredDescription
textStringCaption text (max 20,000 characters)
images/imageFilesArrayImage files or uploaded image data
targetTypeEnumTarget type (user or community)
targetIdStringTarget ID (userId or communityId)
tagsArray<String>Tags for categorization
metadataObjectCustom metadata
func createImagePostExample(images: [AmityImageData], text: String) async {
    // Build your post structure
    let builder = AmityImagePostBuilder()
    builder.setText(text)
    builder.setImages(images)
    // Create a post from the builder
    do {
        let post = try await postRepository.createImagePost(builder, targetId: nil, targetType: .user, metadata: nil, mentionees: nil)
    } catch {
        // Handle error here
    }
}

Best Practices

  • Compress images before upload to reduce file size
  • Resize images to appropriate dimensions (e.g., 1080x1080)
  • Use appropriate file formats (JPEG for photos, PNG for graphics)
  • Implement progress indicators for large uploads
  • Show image previews before posting
  • Allow users to reorder images
  • Provide crop and edit functionality
  • Handle upload failures gracefully with retry options
  • Upload images in parallel when possible
  • Cache uploaded images to avoid re-uploads
  • Implement lazy loading for image previews
  • Use appropriate image loading libraries

Troubleshooting

Problem: Images fail to upload or post creation failsSolutions:
  • Check file size (must be under 100MB per image)
  • Verify supported format (JPEG, PNG, WebP)
  • Ensure stable internet connection
  • Implement retry logic with exponential backoff
try {
  const fileId = await FileRepository.uploadImage(imageFile);
  // Proceed with post creation
} catch (error) {
  if (error.code === 'FILE_TOO_LARGE') {
    // Compress image and retry
  } else if (error.code === 'NETWORK_ERROR') {
    // Implement retry logic
  }
}
Problem: Images appear blurry or low qualitySolutions:
  • Upload images at optimal resolution (1080x1080 or higher)
  • Avoid excessive compression before upload
  • Use appropriate file formats (JPEG for photos, PNG for graphics)
// Recommended image dimensions
const optimalDimensions = {
  square: { width: 1080, height: 1080 },
  landscape: { width: 1200, height: 630 },
  portrait: { width: 1080, height: 1350 }
};
Problem: App crashes or becomes slow with large imagesSolutions:
  • Implement image compression before upload
  • Use image loading libraries with memory management
  • Resize images to appropriate dimensions
  • Clear image cache periodically
// Example: Compress image before upload
const compressedImage = await compressImage(originalImage, {
  maxWidth: 1200,
  maxHeight: 1200,
  quality: 0.8
});
Parent-Child Structure: When you upload multiple images, the main post becomes the parent, and each image creates a child post that users can individually react to and comment on.

Common Use Cases

  • Photo Sharing: Share personal photos and memories
  • Product Showcases: Display products with multiple angles
  • Event Documentation: Share photos from events and gatherings
  • Before/After Comparisons: Show transformations or progress
  • Step-by-Step Guides: Visual tutorials and instructions
  • Gallery Posts: Curated collections of related images