Imagepicker not working, selection is empty
See original GitHub issueWhich platform(s) does your issue occur on?
- Both
- iOS 10 - 11/Android 7
- emulator and device. iPhone 5s - Xiaomi Mi Note 4
Please, provide the following version numbers that your issue occurs with:
- CLI: 4.0.0
- Cross-platform modules: 4.0.0
- Runtime(s): 4.0.1
- Plugin(s): “dependencies”: { “@angular/animations”: “~5.2.0”, “@angular/common”: “~5.2.0”, “@angular/compiler”: “~5.2.0”, “@angular/core”: “~5.2.0”, “@angular/forms”: “~5.2.0”, “@angular/http”: “~5.2.0”, “@angular/platform-browser”: “~5.2.0”, “@angular/platform-browser-dynamic”: “~5.2.0”, “@angular/router”: “~5.2.0”, “nativescript-angular”: “~5.2.0”, “nativescript-camera”: “^4.0.2”, “nativescript-drop-down”: “^3.2.1”, “nativescript-imagepicker”: “^6.0.1”, “nativescript-iqkeyboardmanager”: “^1.2.0”, “nativescript-ngx-fonticon”: “^4.1.0”, “nativescript-plugin-firebase”: “^5.2.0”, “nativescript-social-login”: “^4.0.0”, “nativescript-sqlite”: “^2.0.1”, “nativescript-telerik-ui”: “^3.1.4”, “nativescript-theme-core”: “~1.0.4”, “nativescript-ui-listview”: “^3.5.4”, “nativescript-ui-sidedrawer”: “^3.5.2”, “reflect-metadata”: “~0.1.10”, “rxjs”: “~5.5.5”, “tns-core-modules”: “^4.0.0”, “zone.js”: “~0.8.18” }, “devDependencies”: { “@angular/compiler-cli”: “~5.2.0”, “@ngtools/webpack”: “~1.9.1”, “babel-traverse”: “6.4.5”, “babel-types”: “6.4.5”, “babylon”: “6.4.5”, “clean-webpack-plugin”: “~0.1.19”, “codelyzer”: “~4.0.2”, “copy-webpack-plugin”: “~4.3.0”, “css-loader”: “~0.28.7”, “extract-text-webpack-plugin”: “~3.0.2”, “lazy”: “1.0.11”, “nativescript-dev-sass”: “^1.3.5”, “nativescript-dev-typescript”: “~0.6.0”, “nativescript-dev-webpack”: “^0.11.0”, “nativescript-worker-loader”: “~0.8.1”, “raw-loader”: “~0.5.1”, “resolve-url-loader”: “~2.2.1”, “sass-loader”: “~6.0.6”, “tns-platform-declarations”: “^4.0.0”, “tslint”: “~5.8.0”, “typescript”: “~2.6.2”, “uglifyjs-webpack-plugin”: “~1.1.6”, “webpack”: “~3.10.0”, “webpack-bundle-analyzer”: “^2.9.1”, “webpack-sources”: “~1.1.0” }
Please, tell us how to recreate the issue in as much detail as possible.
When trying to select an image, this code that I’ve been using for a while stopped working, returning undefined is not an object (evaluating 'file.split'). Also, according to the demo provided selection[0] returns
{
"_observers": {},
"_options": {
"keepAspectRatio": true
},
"_ios": {}
}
Is there any code involved?
private _startSelection(context) {
context.authorize().then(() => {
return context.present();
}).then((selection) => {
selection.forEach((selected) => this.user.image = selected.fileUri);
const base64 = this._imgToBase64(this.user.image);
const data = `data:image/${this.user.image.split('.').pop().toLowerCase()};base64,${base64}`;
this._userService.saveImage({image: data}).subscribe(
(result: any) => {
console.log(result);
},
(error: any) => {
console.log(error);
}
);
this._changeDetectionRef.detectChanges();
}).catch((e) => console.log(e));
}
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:21 (4 by maintainers)
Top Results From Across the Web
Flutter - ImagePicker does not display the image selected
The problem is getImage does not return a type of file, but a type of. Future<PickedFile>. So you need to do the following....
Read more >flutter ios image picker not working doesn't select it - You.com
Here is a what's happening : I'm trying to upload an image from gallery to my app on iOS simulator. Image Picker opens...
Read more >image_picker | Flutter Package - Pub.dev
Flutter plugin for selecting images from the Android and iOS image library, and taking new pictures with the camera.
Read more >How to Select an Image from Gallery in Android?
Steps to implement image selection from the gallery · Step 1: Create an empty activity project · Step 2: Working with the activity_main.xml....
Read more >Image picker issue: empty images - Get Help - Adalo - Forum
btw I can and do work with conditions based on whether a photo is added in the image picker. But this triggers on...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@sivamamidi-REISys the issue you’re facing is about
getImagemethod.If you upgraded to 6.0 forget about this method. What you need to do now is:
@lini thank you for your reply.
Yes that’s correct.
I’ve tried that and it doesn’t work. The solution above relies on the
selectionwhich for me looks like this:I can definitely confirm that that’s the case. Even testing the demo app gives me the same issue.