-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[image_picker] Image picker fix metadata #3873
Conversation
I've noticed that if you try to select this image: Per #3835 (comment),
|
The specific issue I'm seeing seems related to https://developer.apple.com/forums/thread/654021 At the very bottom of the thread, someone notes:
He gave a workaround: let supportedRepresentations = [UTType.rawImage.identifier,
UTType.tiff.identifier,
UTType.bmp.identifier,
UTType.png.identifier,
UTType.heif.identifier,
UTType.heic.identifier,
UTType.jpeg.identifier,
UTType.webP.identifier,
UTType.gif.identifier,
]
for representation in supportedRepresentations {
if result.itemProvider.hasRepresentationConforming(toTypeIdentifier: representation, fileOptions: .init()) {
result.itemProvider.loadInPlaceFileRepresentation(forTypeIdentifier: representation) { (originalUrl, inPlace, error) in Have you tested with HEIC and other (non-JPEG) image formats on device? |
Hi @cpboyd , thanks for the review! Yes, I have tested with the HEIC format. But as you mentioned above there is a known issue related to |
@ydag Ah, so the JPEG transcoding is simulator only? Is the transcoding expected from PHPicker or does this only occur when not given full permissions to the image? |
@cpboyd This is not about the permissions. Even with full permission, it will fail on the simulator. |
@@ -1,3 +1,8 @@ | |||
## 0.7.6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there's no publish API change, it should be 0.7.5+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
@@ -20,7 +20,8 @@ NS_ASSUME_NONNULL_BEGIN | |||
|
|||
+ (UIImage *)scaledImage:(UIImage *)image | |||
maxWidth:(NSNumber *)maxWidth | |||
maxHeight:(NSNumber *)maxHeight; | |||
maxHeight:(NSNumber *)maxHeight | |||
metadataAvailability:(BOOL)metadataAvailability; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since it's a bool, the name should be more like a bool, maybe isMetadataAvailable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
[FLTImagePickerImageUtil scaledImage:localImage | ||
maxWidth:maxWidth | ||
maxHeight:maxHeight | ||
metadataAvailability:originalAsset == nil ? NO : YES]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can simply be metadataAvailability:originalAsset != nil];
ditto below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
UIImage *newImage = [FLTImagePickerImageUtil scaledImage:image | ||
maxWidth:@3 | ||
maxHeight:@2 | ||
metadataAvailability:YES]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you also test the scenario with no meta data?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This pull request is not suitable for automatic merging in its current state.
|
This PR fixes a rotation problem where "Select Photos" limited access is chosen but the image that is picked is not included in selected photos and the image is scaled.
This PR fixes a rotation problem where "Select Photos" limited access is chosen but the image that is picked is not included in selected photos and the image is scaled. # Conflicts: # packages/image_picker/image_picker/pubspec.yaml
This PR fixes a rotation problem where "Select Photos" limited access is chosen but the image that is picked is not included in selected photos and the image is scaled.
List which issues are fixed by this PR. You must list at least one issue.
If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.
Pre-launch Checklist
dart format
. See plugin_tool format)[shared_preferences]
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.