> ## Documentation Index
> Fetch the complete documentation index at: https://learn.social.plus/llms.txt
> Use this file to discover all available pages before exploring further.

# Image Posts

> Create image posts with uploaded image files using the current Social+ SDKs.

Image posts combine one or more uploaded images with an optional text caption. Upload the images first, then pass the uploaded image objects or file IDs to the post creation API.

<Info>
  This page focuses on the SDK call that creates the post. See [Image Handling](/social-plus-sdk/core-concepts/content-handling/files-images-and-videos/image-handling) for upload steps, supported file inputs, and upload constraints.
</Info>

<CardGroup cols={2}>
  <Card title="Uploaded Images" icon="images">
    Create posts from image objects or file IDs returned by the file upload flow.
  </Card>

  <Card title="Caption Support" icon="text">
    Add text, metadata, mentions, or other SDK-supported post fields alongside the images.
  </Card>
</CardGroup>

## Parameters

| Parameter                               | Required | Description                                                   |
| --------------------------------------- | -------- | ------------------------------------------------------------- |
| `images`, `uploadedImages`, or `fileId` | Yes      | Uploaded image objects or image file IDs, depending on SDK.   |
| `text`                                  | No       | Caption text shown with the image post.                       |
| `targetType`                            | Yes      | Feed target, usually `community` or `user`.                   |
| `targetId`                              | Yes      | Community ID or user ID for the target feed.                  |
| `metadata`                              | No       | Custom metadata stored with the post where supported.         |
| `mentionees`                            | No       | User mention payload where supported by the platform builder. |

## Create an Image Post

The examples below create an image post in a community. Replace the target with the SDK's user-feed target when posting to a user.

<CodeGroup>
  ```swift iOS theme={null}
  func createImagePost(
      uploadedImages: [AmityImageData],
      communityId: String
  ) async throws -> AmityPost {
      let postRepository = AmityPostRepository()
      let builder = AmityImagePostBuilder()
      builder.setImages(uploadedImages)
      builder.setText("Photos from today")

      return try await postRepository.createImagePost(
          builder,
          targetId: communityId,
          targetType: .community,
          metadata: nil,
          mentionees: nil
      )
  }
  ```

  ```kotlin Android theme={null}
  fun createImagePost(
      uploadedImages: Set<AmityImage>,
      communityId: String
  ) {
      postRepository.createImagePost(
          targetType = AmityPost.TargetType.COMMUNITY,
          targetId = communityId,
          images = uploadedImages,
          text = "Photos from today"
      )
          .subscribe({ post ->
              showSuccessMessage(post.getPostId())
          }, { error ->
              handleGeneralError(error)
          })
  }
  ```

  ```typescript TypeScript theme={null}
  import { PostRepository } from "@amityco/ts-sdk";

  const { data: post } = await PostRepository.createPost({
    targetType: "community",
    targetId: communityId,
    data: {
      text: "Photos from today",
    },
    attachments: [
      {
        type: "image",
        fileId,
      },
    ],
  });
  ```

  ```dart Flutter theme={null}
  Future<AmityPost> createImagePost(List<AmityImage> uploadedImages) {
    return AmitySocialClient.newPostRepository()
        .createPost()
        .targetCommunity(communityId)
        .image(uploadedImages)
        .text('Photos from today')
        .post();
  }
  ```
</CodeGroup>

## Notes

* TypeScript accepts image attachments as `{ type: "image", fileId }`.
* Android accepts a `Set<AmityImage>`.
* iOS accepts `[AmityImageData]`.
* Flutter accepts `List<AmityImage>`.

For mixed attachment types, use [Mixed Media Posts](./mixed-media-post).

## Related Topics

<CardGroup cols={3}>
  <Card title="Image Handling" icon="upload" href="/social-plus-sdk/core-concepts/content-handling/files-images-and-videos/image-handling">
    Upload images before creating image posts.
  </Card>

  <Card title="Mixed Media Posts" icon="layer-group" href="./mixed-media-post">
    Combine images with other supported media attachments.
  </Card>

  <Card title="Posts Overview" icon="newspaper" href="../overview">
    Review post concepts, retrieval, and moderation flows.
  </Card>
</CardGroup>
