Skip to content

Commit

Permalink
[image_picker] delete original file if scaled (flutter#1288)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivk1800 authored and Chris Yang committed Mar 11, 2019
1 parent 9017d6e commit 4b24153
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/image_picker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.5.0+6

* Delete the original image if it was scaled.

## 0.5.0+5

Remove unnecessary camera permmision.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
2 changes: 1 addition & 1 deletion packages/image_picker/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors:
- Flutter Team <[email protected]>
- Rhodes Davis Jr. <[email protected]>
homepage: https://github.com/flutter/plugins/tree/master/packages/image_picker
version: 0.5.0+5
version: 0.5.0+6

flutter:
plugin:
Expand Down

0 comments on commit 4b24153

Please sign in to comment.