Giter VIP home page Giter VIP logo

Comments (4)

hongnk avatar hongnk commented on August 16, 2024 2

Ok this is not an issue. I found out that on android resolveLocalFileSystemURL doesn't work with full path. Need to call resolveLocalFileSystemURL for cordova.file.applicationStorageDirectory then loop through the entries to find the cached image.

It is mentioned in here: https://stackoverflow.com/questions/35192695/phonegap-cordova-for-android-file-plugin-error-code-1/35208599#35208599

The cache image is private to the application, so searching in explorer doesn't show it, unless the phone is rooted.

from cordova-plugin-imagepicker.

hongnk avatar hongnk commented on August 16, 2024 1

`
window.resolveLocalFileSystemURL(path, function (fileEntry) {
fileEntry.file(function(file) {
cb(file)
}, function() {
alert('error');
});

}, function (e) {
//window.alert("error: " + JSON.stringify(e));
//on Androi, need to loop
var dirEntry = function (entry) {
var dirReader = entry.createReader();
dirReader.readEntries(
function (entries) {
Array.from(entries).forEach(function (n, i) {
if (n.isDirectory === true) {
if (n.nativeURL.indexOf('/cacheCompressHelper') > -1 || n.nativeURL.indexOf('/Documents') > -1) {
var dirReader2 = n.createReader();
dirReader2.readEntries(function(files) {
//found the target /res directory
Array.from(files).forEach(function (f, i) {
if(f.isFile && f.nativeURL.indexOf(path)>=0) {
f.file(function(file) {
cb(file)
}, function() {
alert('error');
});
}
})
})
return false; //no need to iterate more
} else {
// Recursive -- call back into this subdirectory
dirEntry(n);
}
}
});

        },
        function (error) {
            console.log("readEntries error: " + error.code);
        }
    );
  };

  var dirError = function (error) {
      console.log("getDirectory error: " + error.code);
  };

  window.resolveLocalFileSystemURL(cordova.file.applicationStorageDirectory, dirEntry, dirError);

});
}
`

from cordova-plugin-imagepicker.

F5F5 avatar F5F5 commented on August 16, 2024

@hongnk I have same problem,and I don't understand stackoverflow's answer,Can you show your read image file code in here?thank you very much!: )

from cordova-plugin-imagepicker.

giantss avatar giantss commented on August 16, 2024

oh,I didn't have such a problem.

from cordova-plugin-imagepicker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.