Skip to content

Commit

Permalink
Fix: image upload warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Akalanka47000 committed Apr 13, 2024
1 parent b0d9fb9 commit fec9397
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/controls/image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ const ImageControls = ({ options: { maxImageSize = 1024000 } = {} }: IImageContr
const f = e.target.files[0];
if (!f) return;
if (f.size > maxImageSize) {
const kb = maxImageSize / 1024;
window.toast.warning(`Image size should be less than ${kb > 1024 ? `${kb / 1024} MB` : `${kb} KB`}`);
const kb = +(maxImageSize / 1024).toFixed(0);
window.toast.warning(`Image size should be less than ${kb > 1024 ? `${(kb / 1024).toFixed(0)} MB` : `${kb} KB`}`);
e.target.value = "";
return;
}
setFile(await toBase64(f));
Expand Down

0 comments on commit fec9397

Please sign in to comment.