There is a place to upload images in the flutter app, it is uploaded to S3, it takes an average of 10 seconds to upload via the api in the backend, the image size is 800:800, the size is around 300 kb, how can I speed it up?
There is a place to upload images in the flutter app, it is uploaded to S3, it takes an average of 10 seconds to upload via the api in the backend, the image size is 800:800, the size is around 300 kb, how can I speed it up?
CodePudding user response:
There are several ways to potentially speed up the image upload process:
You can use a package like image to compress the image before uploading it to S3. This will reduce the file size and speed up the upload process.
You can use a package like image_optimizer to optimize the image for the web before uploading. This will reduce the file size and make the image load faster on the web.
You can Use resumable uploads: S3 supports resumable uploads, which allows you to continue an upload after a connection interruption.
You can Use a Content Delivery Network (CDN): A CDN can help distribute the image to multiple servers closer to the user, which can reduce the time it takes to upload the image.
CodePudding user response:
Future getImage(bool isFromCamera) async {
return await imagePicker.getImage(
source: isFromCamera ? ImageSource.camera : ImageSource.gallery,
maxHeight: 800.0,
maxWidth: 800.0);
}