0

I am using andt upload component to upload multiple image at the same time. But when uploading large size image its causing problem. Is there any way to reduce the image size when converting the image in base64 format.

this is my upload component

<Upload
       name="Upload"
       listType="picture-card"
       className="avatar-uploader"
       showUploadList={false}
       maxCount={20}
       multiple
       onPreview={onPreview}
       beforeUpload={beforeUpload}
       onChange={handleChange}
       >

Here i am calling the base64 function

getBase64(info.file.originFileObj, imageUrl =>
          base64Image(imageUrl),
    );

function to convert into base64

function getBase64(img, callback) {
    const reader = new FileReader();
    reader.addEventListener('load', () => callback(reader.result));
    reader.readAsDataURL(img);
 }
        

0 Answers0