Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 70fcc65

Browse files
authored
[image_picker] Fix rotation when camera is a source (#4019)
* Fix isMetadataAvailable bool * Add unit test * Update CHANGELOG and version
1 parent 642a483 commit 70fcc65

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

packages/image_picker/image_picker/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.8.0+2
2+
3+
* Fix a rotation problem where when camera is chosen as a source and additional parameters are added.
4+
15
## 0.8.0+1
26

37
* Removed redundant request for camera permissions.

packages/image_picker/image_picker/example/ios/RunnerTests/ImageUtilTests.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ - (void)testScaledImage_ShouldBeScaledWithNoMetadata {
3434
XCTAssertEqual(newImage.size.height, 2);
3535
}
3636

37+
- (void)testScaledImage_ShouldBeCorrectRotation {
38+
UIImage *image = [UIImage imageWithData:ImagePickerTestImages.JPGTestData];
39+
UIImage *newImage = [FLTImagePickerImageUtil scaledImage:image
40+
maxWidth:@3
41+
maxHeight:@2
42+
isMetadataAvailable:YES];
43+
44+
XCTAssertEqual(newImage.imageOrientation, UIImageOrientationUp);
45+
}
46+
3747
- (void)testScaledGIFImage_ShouldBeScaled {
3848
// gif image that frame size is 3 and the duration is 1 second.
3949
GIFInfo *info = [FLTImagePickerImageUtil scaledGIFImage:ImagePickerTestImages.GIFTestData

packages/image_picker/image_picker/ios/Classes/FLTImagePickerPlugin.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ - (void)imagePickerController:(UIImagePickerController *)picker
460460
image = [FLTImagePickerImageUtil scaledImage:image
461461
maxWidth:maxWidth
462462
maxHeight:maxHeight
463-
isMetadataAvailable:originalAsset != nil];
463+
isMetadataAvailable:YES];
464464
}
465465

466466
if (!originalAsset) {

packages/image_picker/image_picker/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: Flutter plugin for selecting images from the Android and iOS image
33
library, and taking new pictures with the camera.
44
repository: https://github.com/flutter/plugins/tree/master/packages/image_picker/image_picker
55
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+image_picker%22
6-
version: 0.8.0+1
6+
version: 0.8.0+2
77

88
environment:
99
sdk: ">=2.12.0 <3.0.0"

0 commit comments

Comments
 (0)