Skip to content
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

Output type option - File URI or Base64 Encoded String #65

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

rabeyta
Copy link

@rabeyta rabeyta commented May 26, 2015

I added an outputType parameter to the input options that will dictate whether an array of File URIs or Base64 encoded strings are returned from the image picker.

@arvindr21
Copy link

+1

@lamson-dev
Copy link

I just tried this pull request. It works great on iOS emulator, but base64 output type does not work on my Android device some how. Could someone please double check?

@rabeyta
Copy link
Author

rabeyta commented Jun 9, 2015

@Lamson Do you have any error messages or logs? I have verified this PR with my ionic app. The same JS code (expecting base64 strings) works in both iOS simulator (8.3) and the Android emulator (4.4.2) without any code changes. If you have any specific steps or debug messages to share I would appreciate them. They would help in troubleshooting your issue. Thanks!

@lamson-dev
Copy link

@rabeyta I tried adb logcat and found this error "FAILED BINDER TRANSACTION !!!" I ran it on my Nexus 5, after selecting photos, clicking Ok doesn't close the image picker and gets stuck there some how. I found this thread on SO http://stackoverflow.com/questions/3528735/failed-binder-transaction

Here is my cordova-image-picker options:
options = {
maximumImagesCount: 10,
width: 1000,
height: 1000,
};

I tried to reduce width/height to 500, and suddenly it works if 1 image is selected. More than 1 image selected would crash my app some how. Changing width/height to 200 let me select ~5-6 images, then my app crashes if more images are selected

Do you have any ideas?

@rabeyta
Copy link
Author

rabeyta commented Jun 30, 2015

@Lamson Sorry for the delay. With the options you have selected, you are not actually using the Base64Encoding that this pull request adds. You are using the base plugin. Adding outputType: 1 to your options would have the files returned as base64 Encoded strings.

When i use this plugin in my application, i do not set width / heights and I usually limit it to around 5 images. I can try more later today or tomorrow and see the behavior. I am then resizing the output myself to one of two different sizes based on the needs and flow in my application (thumbnail / reduced image or both).

The problem you are having sounds like it is in the underlining plugin. I will try to test some more and get back to you. I usually am testing on iOS though as that is my primary target at this time.

@lamson-dev
Copy link

@rabeyta Sorry I forgot to include the outputType: 1 param to the comment. I actually had that added in my code. Again, it's an Android issue, it works great on iOS! Thanks for adding this PR and looking into the problems!

@rabeyta
Copy link
Author

rabeyta commented Jul 3, 2015

@Lamson After doing some research and testing, I was able to validate the behavior you are seeing with the 'FAILED BINDER TRANSACTION'. I never ran into this as I am only focusing on iOS and limiting the number of photos selected at a time.

This post on SO (2011) and many others mention a 1MB bundle limit. When you exceed the limit then you are shown the 'failed binder transaction' error.
http://stackoverflow.com/questions/7888890/failed-binder-transaction-on-widget-update

The reason we hit this limit is the Base64Encoded images combined are exceeding the limit. The actual resized images are being returned and not a string with the path to them. When you select the default outputType, only the file paths are returned which shouldn't exceed this limit.

@candelibas
Copy link

Any progress?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants