Sample photos before load

This commit is contained in:
Victor Shcherb 2021-02-03 17:02:39 +01:00
parent 0f9673cd2e
commit 0b92765f87

View file

@ -180,7 +180,9 @@ public class UploadPhotosAsyncTask extends AsyncTask<Void, Integer, Void> {
private byte[] compressImageToJpeg(InputStream image) { private byte[] compressImageToJpeg(InputStream image) {
BufferedInputStream bufferedInputStream = new BufferedInputStream(image); BufferedInputStream bufferedInputStream = new BufferedInputStream(image);
Bitmap bmp = BitmapFactory.decodeStream(bufferedInputStream); BitmapFactory.Options opts = new BitmapFactory.Options();
opts.inSampleSize = 4;
Bitmap bmp = BitmapFactory.decodeStream(bufferedInputStream, null, opts);
ByteArrayOutputStream os = new ByteArrayOutputStream(); ByteArrayOutputStream os = new ByteArrayOutputStream();
int h = bmp.getHeight(); int h = bmp.getHeight();
int w = bmp.getWidth(); int w = bmp.getWidth();