add additional logging to image compression
This commit is contained in:
parent
68fd17778c
commit
eed5c5e743
|
@ -746,12 +746,15 @@ public class FileBackend {
|
||||||
final int imageMaxSize = mXmppConnectionService.getResources().getInteger(R.integer.auto_accept_filesize);
|
final int imageMaxSize = mXmppConnectionService.getResources().getInteger(R.integer.auto_accept_filesize);
|
||||||
while (!targetSizeReached) {
|
while (!targetSizeReached) {
|
||||||
os = new FileOutputStream(file);
|
os = new FileOutputStream(file);
|
||||||
|
Log.d(Config.LOGTAG, "compressing image with quality " + quality);
|
||||||
boolean success = scaledBitmap.compress(Config.IMAGE_FORMAT, quality, os);
|
boolean success = scaledBitmap.compress(Config.IMAGE_FORMAT, quality, os);
|
||||||
if (!success) {
|
if (!success) {
|
||||||
throw new FileCopyException(R.string.error_compressing_image);
|
throw new FileCopyException(R.string.error_compressing_image);
|
||||||
}
|
}
|
||||||
os.flush();
|
os.flush();
|
||||||
targetSizeReached = file.length() <= imageMaxSize || quality <= 50;
|
final long fileSize = file.length();
|
||||||
|
Log.d(Config.LOGTAG, "achieved file size of " + fileSize);
|
||||||
|
targetSizeReached = fileSize <= imageMaxSize || quality <= 50;
|
||||||
quality -= 5;
|
quality -= 5;
|
||||||
}
|
}
|
||||||
scaledBitmap.recycle();
|
scaledBitmap.recycle();
|
||||||
|
|
Loading…
Reference in a new issue