Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to read image files from sdcard in phonegap: android
    primarykey
    data
    text
    <p>I am a phonegap newbie. I am trying to read and image file from sdcard in android using phonegap official tutorial. The problem is that the image is not being displayed instead a question mark appears in its place. </p> <p>My Code:<br> </p> <pre><code>var pictureSource; var destinationType; document.addEventListener("deviceready",onDeviceReady,false); function onDeviceReady(){ document.getElementById("test").innerHTML="onready about to request"; window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, onFail);} function onFail(message) { alert('Failed because: ' + message); } function gotFS(fileSystem) { fileSystem.root.getFile("1.jpg", null, gotFileEntry, fail); } function gotFileEntry(fileEntry) { fileEntry.file(gotFile, fail); } function gotFile(file){ readDataUrl(file); } function readDataUrl(file) { var reader = new FileReader(); reader.onloadend = function(evt) { console.log("Read as data URL"); console.log(evt.target.result); }; document.getElementById("smallImage").style.display='block'; document.getElementById("smallImage").src = reader.readAsDataURL(file); } function fail(evt) { console.log(evt.target.error.code); } &lt;/script&gt; </code></pre> <p>edit: Using API 16 and min-sdk8 "smallImage" is a tag it's working fine with onphotodatasuccess. So, camera is not a problem here. Everything related to camera functions is ok. Reading from sdcard is posing a problem at the assignment statement.<br> document.getElementById("smallImage").src = reader.readAsDataURL(file); if I add this i get the string and unknown chromium error -6, else i see the usual image converted string. Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload