Typescript issues with images

This is regarding the documentation that states “Once an image is uploaded to the server, the image will be automatically transformed into four different sizes for versatile usage.” It seems like in the Typescript SDK, there is no way to specify the size of the image. Every time I retrieve a community avatar image, for example, it turns out extremely blurry. Is it possible to request a specific size in the Typescript SDK or is this something y’all are still working on?

Hello, please refer to the image handling section in the Amity documentation, which can be found at this link: Image Handling - Amity Docs.

In that section, you will find sample code for retrieving images and an explanation of the available size options. For more information specifically about retrieving images, you can visit this link: Image Handling - Amity Docs.

I’ve already read the documentation and looked at the Typescript example. The issue is that IOS and Android both show that passing an argument to retrieve the desired resolution is possible. However, the Typescript example doesn’t. Also, when I looked into the code of the Typescript SDK, the only argument able to be passed to getFile() was the fileId. There was nothing about a resolution size.

Hello @awareai-dev
Thank you for your question. At the moment, I regret to inform you that the Typescript SDK doesn’t offer a direct method to obtain images at the specified resolutions like our other SDKs.

Nevertheless, there is a workaround where you can manually specify the desired image size. After obtaining the image URL using this function, you can append a query string to the end of the URL.

Here’s an example for you:

  • Original URL:
    https://api.us.amity.co/api/v3/files/{file_id}/download
  • With added query string for image size:
    https://api.us.amity.co/api/v3/files/{file_id}/download?size=full

In the ‘size’ parameter, you can specify ‘full’, ‘medium’, or ‘small’, depending on your requirements.

We’re continually working on improving and expanding our SDK capabilities, so do keep an eye out for future updates that might include this feature.

Hope this helps, and let us know if you have any other questions!

Best Regards,
Trust.

Thanks for the response! I look forward to seeing this in a future update!

1 Like