My goal is to display a jpg image from the data directory of an Android phone, not a photo taken by the camera. Here's the code I've worked on so far:
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady(){
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onFileSystemSuccess);
}
function onFileSystemSuccess(fileSystem){
fileSystem.root.getDirectory("../data", {create: false, exclusive: false}, dirSuccess);
}
function dirSuccess(getDir){
getDir.getFile("test.jpg", {create: false, exclusive: false}, fileSuccess);
}
I have a couple of questions that need clarification. First, I'm unsure if my code will successfully access the desired image file. Are there any errors in what I've written so far? Secondly, I'm stuck on how to actually display the image on the app page. Do I just need to specify the image file name in the src attribute of the img tag within the fileSuccess method? or is there something else I should be doing? I'm new to PhoneGap and JavaScript, so this may be a simple issue. Nevertheless, any assistance would be greatly appreciated. Thank you... :)