diff --git a/packages/image_picker/CHANGELOG.md b/packages/image_picker/CHANGELOG.md index 27713d639848..e4230963e712 100644 --- a/packages/image_picker/CHANGELOG.md +++ b/packages/image_picker/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.5.0+6 + +* Delete the original image if it was scaled. + ## 0.5.0+5 Remove unnecessary camera permmision. diff --git a/packages/image_picker/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java b/packages/image_picker/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java index a990c435106f..eb1e990045c1 100644 --- a/packages/image_picker/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java +++ b/packages/image_picker/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerDelegate.java @@ -429,6 +429,11 @@ private void handleImageResult(String path) { String finalImagePath = imageResizer.resizeImageIfNeeded(path, maxWidth, maxHeight); finishWithSuccess(finalImagePath); + + //delete original file if scaled + if (!finalImagePath.equals(path)) { + new File(path).delete(); + } } else { throw new IllegalStateException("Received image from picker that was not requested"); } diff --git a/packages/image_picker/pubspec.yaml b/packages/image_picker/pubspec.yaml index 7a1a57fd233b..454965fee105 100755 --- a/packages/image_picker/pubspec.yaml +++ b/packages/image_picker/pubspec.yaml @@ -5,7 +5,7 @@ authors: - Flutter Team - Rhodes Davis Jr. homepage: https://github.com/flutter/plugins/tree/master/packages/image_picker -version: 0.5.0+5 +version: 0.5.0+6 flutter: plugin: