-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android: encodingType is not ignored when sourceType is set with PHOTOLIBRARY or SAVEDPHOTOALBUM #769
Comments
Looks like this might have been a regression introduced from #731 |
Thank @breautek for the hint. In such case, can the PR be reverted @PieterVanPoyer ? Also we are seeing weird problems in this use case, like file name changing to png.jpg in pixel devices and modified.jpg in samsung devices (same name for every image being picked) etc. by which its overwriting in temp folder by the last selected picture. So apart from unnecessary conversion, it leading to other issues as well. |
Hey @5r1m I think you are correct. The documentation and implementation are not in sync. Something must be done to fix this mismatch. At this point there is still a difference between these 2 implementations. On Android only next formats are being transformed - cordova-plugin-camera/src/android/CameraLauncher.java Lines 790 to 791 in ed216ce
On iOs, a Gif, a BMP, and more types are being transformed to the encodingType. Kind regards |
Yes, ideally iOS and Android should be in sync and especially when they are not specific to any platform support/limitation. How ever now the question is
But I think it's not like one thing fits all. In this new version, there is no way to avoid transformation 100% until we know the mime type which user will be selecting well ahead, which is not possible. So instead of forcing the transformation in such cases, why not extend the API to provide options on doing the transformation for selected types only? This way it gives control on transformation to be done or not to API consumers which would be more optimal. Thanks. |
I know this is almost a year old and the library seems abandoned, but here are my two cents from a fellow dev which is trying (hard) to use the library: While keeping the conversion would break compatibility, I'd say bump the minor (maybe even the major version, I know it feels harsh but that's what major versions are for) and KEEP the transform! It makes NO sense on:
If it is technically possible to convert the picture and always return a given type, why skip that step? When reading the docs, I thought it was a tech limitation, but it looks like it was by design? |
As per documentation: https://cordova.apache.org/docs/en/10.x/reference/cordova-plugin-camera/#cameraoptions-errata
"encodingType" should be ignored when source type is PHOTOLIBRARY or SAVEDPHOTOALBUM. How ever when "encodingType" is set with "Camera.EncodingType.JPEG" and selecting a png picture from album results in unecessary transformation and is not as per the documentation
The reason seems to be unnecessary check for mime type of the choosen file to match the encodingType in options and when not matched it does the transformation:
cordova-plugin-camera/src/android/CameraLauncher.java
Line 729 in ed216ce
Is this a bug or a known behavior? Atleast there is difference in documentation and implementation and there is no option to avoid transformation with out providing the same encoding type which is not possible to provide before hand
The text was updated successfully, but these errors were encountered: