The shrinked images' sizes are now compared with the limit and not the untouched originals.
This commit is contained in:
@@ -34,8 +34,8 @@ android {
|
||||
applicationId "de.beyondsoft.ownchat"
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 26
|
||||
versionCode 11
|
||||
versionName "1.11"
|
||||
versionCode 12
|
||||
versionName "1.12"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
multiDexEnabled true
|
||||
}
|
||||
|
||||
@@ -421,17 +421,17 @@ public class ChatPresenter extends MVPAbstractPresenter<ChatView> implements Cha
|
||||
return;
|
||||
}
|
||||
|
||||
if(mUploadMaxSizePreference.get() > 0 && file.length() > mUploadMaxSizePreference.get()) {
|
||||
getView().showError(R.string.error_file_is_too_large);
|
||||
return;
|
||||
}
|
||||
|
||||
if(mimeType != null && (mimeType.equals(Constants.MIME_TYPE_JPEG) || mimeType.equals(Constants.MIME_TYPE_PNG)) && (file.length() > (1000L * 1024L))) {
|
||||
FileUtils.clearTmpFilesDir(mContext);
|
||||
|
||||
file = FileUtils.scaleImageDown(file, mContext);
|
||||
}
|
||||
|
||||
if(mUploadMaxSizePreference.get() > 0 && file.length() > mUploadMaxSizePreference.get()) {
|
||||
getView().showError(R.string.error_file_is_too_large);
|
||||
return;
|
||||
}
|
||||
|
||||
final File fileToSend = file;
|
||||
|
||||
String[] split = fileToSend.getAbsolutePath().split("/");
|
||||
@@ -615,17 +615,17 @@ public class ChatPresenter extends MVPAbstractPresenter<ChatView> implements Cha
|
||||
return;
|
||||
}
|
||||
|
||||
if(mUploadMaxSizePreference.get() > 0 && file.length() > mUploadMaxSizePreference.get()) {
|
||||
getView().showError(R.string.error_file_is_too_large);
|
||||
return;
|
||||
}
|
||||
|
||||
if(mimeType != null && (mimeType.equals(Constants.MIME_TYPE_JPEG) || mimeType.equals(Constants.MIME_TYPE_PNG)) && (file.length() > (1000L * 1024L))) {
|
||||
FileUtils.clearTmpFilesDir(mContext);
|
||||
|
||||
file = FileUtils.scaleImageDown(file, mContext);
|
||||
}
|
||||
|
||||
if(mUploadMaxSizePreference.get() > 0 && file.length() > mUploadMaxSizePreference.get()) {
|
||||
getView().showError(R.string.error_file_is_too_large);
|
||||
return;
|
||||
}
|
||||
|
||||
final File fileToSend = file;
|
||||
|
||||
// create RequestBody instance from file
|
||||
|
||||
Reference in New Issue
Block a user