Fix issue with upload image

This commit is contained in:
Sylvain Berfini 2015-05-15 15:01:34 +02:00
parent 130932b98b
commit 28a6f800a5
2 changed files with 9 additions and 6 deletions

View file

@ -552,10 +552,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
protected byte[] doInBackground(Bitmap... params) {
Bitmap bm = params[0];
if (bm.getWidth() > bm.getHeight() && bm.getWidth() > SIZE_MAX) {
if (bm.getWidth() >= bm.getHeight() && bm.getWidth() > SIZE_MAX) {
bm = Bitmap.createScaledBitmap(bm, SIZE_MAX, (SIZE_MAX * bm.getHeight()) / bm.getWidth(), false);
} else if (bm.getHeight() > bm.getWidth() && bm.getHeight() > SIZE_MAX) {
} else if (bm.getHeight() >= bm.getWidth() && bm.getHeight() > SIZE_MAX) {
bm = Bitmap.createScaledBitmap(bm, (SIZE_MAX * bm.getWidth()) / bm.getHeight(), SIZE_MAX, false);
}
@ -762,8 +761,12 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
if (mUploadingImageStream != null && size > 0) {
byte[] data = new byte[size];
int read = mUploadingImageStream.read(data, 0, size);
bufferToFill.setContent(data);
bufferToFill.setSize(read);
if (read > 0) {
bufferToFill.setContent(data);
bufferToFill.setSize(read);
} else {
Log.e("Error, upload task asking for more bytes(" + size + ") than available (" + mUploadingImageStream.available() + ")");
}
}
}

@ -1 +1 @@
Subproject commit 028fe666625d1c020030987a8751ebda8ac5fb34
Subproject commit 8eb0f91a9291964781db0658e6cd25a4b1f54a98