Hey i wanted to know if there is a way or a column to get the file size of a Image inside a table?
I have it working here with a close number to what I see on my Macbook.
async function getImageFileSize(imageUrl) {
try {
const fileImg = await fetch(imageUrl).then(r => r.blob());
const sizeInMB = fileImg.size / (1024 * 1024);
if (sizeInMB < 1) {
// If less than 1 MB, represent in KB
const sizeInKB = fileImg.size / 1024;
return sizeInKB.toFixed(2) + " KB";
} else {
// If 1 MB or larger, represent in MB
return sizeInMB.toFixed(2) + " MB";
}
} catch (error) {
console.error('Error fetching image:', error);
throw error;
}
}
return getImageFileSize(p1)
3 Likes
Thank you
1 Like
Awesome For Thiss
1 Like
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.