Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

selected.getImage is not a function #181

Copy link
Copy link
Closed
@pierreamgabriel

Description

@pierreamgabriel
Issue body actions

I'm making an app where some data are stored in a SQL database. But in order to store images and videos I need to get the file uri first. I tried everything I could but nothing worked.

This is how my JS file looks like:

var imagepicker = require("nativescript-imagepicker");
var permissions = require( "nativescript-permissions" );
var ImageSourceModule = require("image-source");

function openImage() { 
   var context = imagepicker.create({ mode: "single" }); // use "multiple" for multiple selection
        context
    .authorize()
    .then(function() {
        return context.present();
    })
    .then(function(selection) {
        selection.forEach(function(selected) {
            selected.getImage().then((source) => {
                    console.log(selected.fileUri); 
                });     
        });  
    }).catch(function (e) {
        alert(e);// process error
    });
}


exports.openImage = openImage;

I can select images without a problem but then I get this error "selected.getImage is not a function".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.