Hello, I was trying to get image thumbnail image for my video upload as per documentation.
I am using this code:
import { FileRepository } from '@amityco/ts-sdk';
function getVideoImageThumbnail() {
const videoImageThumbnail = FileRepository.fileUrlWithSize('fileId', 'medium');
return videoImageThumbnail;
}
When I provide fileId
, method returns me the same fileId
but with ?size=
query appended to it.
I have checked source code and found this:
/**
* Allow to query a file url with a selected size
*
* @param fileUrl the file Url to decorate
* @param size one of the selected sizes
* @returns the computed url for the selected size
*/
export const fileUrlWithSize = (
fileUrl: Amity.File['fileUrl'],
size: 'small' | 'medium' | 'large' | 'full',
) => {
return `${fileUrl}?size=${size}`;
};
Which is not the same as documentation suggests: accepts fileUrl
instead of fileId
So, I am confused, what is the correct way to get thumbnail image?