TS - Image Upload / Download / Sizing

Hello Amity forum!

I would like to ask a simple question.
I can’t find where and how to set/pass the uploaded image to be full size.
I’ve tried a lot ways but when I’m getting the image it returns in a very small resolution.
Your docs describes that there is a way, but I could not find it :smiley:

Uploading:

    const data = new FormData();
    data.append('files', file);

    this.conversation.pendingFile = file;

    //@ts-ignore
    const { data: files } = await FileRepository.uploadImage(data);
    const { fileId } = files[0];

Sending message:

 const imageMessage: any = {
      subChannelId: this.conversationId,
      dataType: MessageContentType.IMAGE,
      fileId,
      text: 'this text is optional field for message image type',
      caption: 'this text is optional field for message image type',
      isFullImage : true,
      metadata: {
        isFullImage: true,
        isFull: true,
      },
    };
  
    try {
      await MessageRepository.createMessage(imageMessage);
      this.conversation.pendingFile = undefined;
    } catch (error: any) {
      //....
    }

View image:

  private async loadImage(fileId: string)
  {
    const image = await FileRepository.getFile(fileId);
    //console.log(image)

    this.img.url = image.data.fileUrl;
    this.img.loading = false;
  }

Thanks for any help!

@remote44 Let me pass this to check with my team, and I’ll get back to you.

@remote44 For your inquiry, we recommend checking this document: Technical FAQ - Amity Docs more details on obtaining higher-quality images.

1 Like