Viewing Post Content
Last updated
Last updated
In Amity's social SDK, posts with images, files, or videos follow a Parent-Child relationship, where each uploaded image/file is represented as a separate child post. When creating an image/file post, any text that is set will act as the Parent post. The Parent post contains a child posts property, which provides an array of AmityPost instances for each child post. For more information about post structure, please refer to -
Each instance of a Post holds several pieces of information, including data, reactions, comments, metadata, child posts, and more. For text posts, you can access the actual data of the post through the data property. Similarly, for child posts, developers can also access the data through the same data property. Additionally, more details about uploaded files and images can be accessed through the provided functions; such as getFileInfo()
or getImageInfo()
.
To illustrate this concept, consider a post that contains both text and an image. In this case, the parent post would be a text post, and its child post would be an image post. By accessing the child posts property of the parent post, you can easily access and manage the child post information, allowing for a more flexible and efficient approach to managing posts in social applications.
Posting visual content such as photos, graphics, or images is facilitated by this type of post. The maximum size for an image is 1 GB, and the image will be automatically transformed into four different sizes for versatile usage which are:
Small
Medium
Large
Full
This allows for flexible usage and easy integration into various social applications. For more information about an image, please refer to the page - Image Handling.
Supported ✅ (Please wait while we prepare a real example!)
There are two ways to download the uploaded image.
Using FileRepository
FileRepository
class provides dedicated downloadImage(..)
method to download images uploaded using same class.
Note: This class does not perform any kind of caching for downloaded image. Please refer to header docs for download method for more details.
Using any third party library or your own implementation
You can download the file / image directly from provided fileUrl
using your own implementation or any custom third party libraries of your choice.
If you are using your own implementation to download image of appropriate size, you need to construct the download url yourself by appending size
query parameter.
For example, to download a small image:
provided URL: https://my-image-download-link-from-amity/123/456
with size query parameter: https://my-image-download-link-from-amity/123/456?size=small
Value for Size
query parameters can be: small, medium, large, or full.
This is a post that contains a file attachment, such as a PDF, a Word document, or any other type of file. This is a useful type of post for sharing files within a channel, such as a document or a photo. The maximum size for a file is 1 GB. For more information about a video file, please refer to the page - File Handling
This is a useful type of post for sharing video content within a feed, such as a short clip or a longer video. The maximum size for a video is 1 GB, and the video will be automatically transcoded into different resolutions for versatile usage which are
1080p
720p
480p
360p
original
Once you uploaded a video the videos undergo transcoding from their original resolution. You can quickly access the original size of the video right after you make the video post. However, it takes time for the transcoded resolutions to be ready. This allows for flexible usage and easy integration into various social application. For more information about a video file, please refer to the page - Video Handling.
Live stream posts offer an effective means of creating captivating and interactive content that engages users and promotes deeper connections among them. The Amity Social SDK enables developers to swiftly integrate live stream posts into a social feed, allowing them to share their real-time experiences with other users on the platform. For more information about live stream, please refer to the page - Video.
To implement poll functionality in posts, developers can leverage the existing poll features in Amity SDK and integrate them into posts. Polls can be created as child posts within the post thread, with the poll data and options easily accessible to users. Users can then participate in the poll by selecting their preferred option, and the results can be displayed in posts. For more information about live stream, please refer to the page - Poll.