Skip to content

Commit 14c6e3d

Browse files
ydagjolmiracle
authored andcommitted
[image_picker] Fix rotation when camera is a source (flutter#4019)
* Fix isMetadataAvailable bool * Add unit test * Update CHANGELOG and version # Conflicts: # packages/image_picker/image_picker/CHANGELOG.md # packages/image_picker/image_picker/pubspec.yaml
1 parent a8e1402 commit 14c6e3d

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

packages/image_picker/image_picker/CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
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+
5+
## 0.8.0+1
6+
7+
* Removed redundant request for camera permissions.
8+
9+
## 0.8.0
10+
11+
* BREAKING CHANGE: Changed storage location for captured images and videos to internal cache on Android,
12+
to comply with new Google Play storage requirements. This means developers are responsible for moving
13+
the image or video to a different location in case more permanent storage is required. Other applications
14+
will no longer be able to access images or videos captured unless they are moved to a publicly accessible location.
15+
* Updated Mockito to fix Android tests.
16+
17+
## 0.7.5+4
18+
* Migrate maven repo from jcenter to mavenCentral.
19+
120
## 0.7.5+3
221
* Localize `UIAlertController` strings.
322

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/ios/Tests/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

0 commit comments

Comments
 (0)