Added a file size checker in the ImageUpload component to check the file size of the image that is selected before uploading it to Cloudinary.
This file size checker logic is dynamic and is based on what type of image is being uploaded. The uploading will only happen if the required file size is met. The file size limit is
2Mb for Post, Group Post, and Cover images.
1Mb for all other images.
About the logic
Basically, the component will look for a sizeLimit prop. The file size limit will be 2Mb if sizeLimit prop is set to extended else the file size limit will be set to 1Mb. Post, Group Post, and Cover images will have sizeLimit of extended.
Fixes #23
Added a file size checker in the ImageUpload component to check the file size of the image that is selected before uploading it to Cloudinary. This file size checker logic is dynamic and is based on what type of image is being uploaded. The uploading will only happen if the required file size is met. The file size limit is
About the logic
Basically, the component will look for a
sizeLimit
prop. The file size limit will be 2Mb ifsizeLimit
prop is set to extended else the file size limit will be set to 1Mb. Post, Group Post, and Cover images will havesizeLimit
of extended.Screenshots
Size limit for group image![image](https://user-images.githubusercontent.com/46086050/193428025-8f24e14e-4e6d-4e8d-9bd2-baf146a5ec17.png)
Size limit for cover photos![image](https://user-images.githubusercontent.com/46086050/193428055-05c61a31-184a-46b3-9a3a-3c7abfb2be2c.png)