Miles M.
Miles M.

Reputation: 4169

What is the best way to diplay images remotely from server in a PhoneGap app

I'm trying to display images from my remote server in an app using phoneGap along with jquery(mobile) and PHP.

I read from the doc that this function does the job:

FileTransfer

Here: http://docs.phonegap.com/en/1.6.0/cordova_file_file.md.html

 // !! Assumes variable url contains a valid URI to a file on a server and filePath is a valid path on the device

var fileTransfer = new FileTransfer();

fileTransfer.download(
    url,
    filePath,
    function(entry) {
        console.log("download complete: " + entry.fullPath);
    },
    function(error) {
        console.log("download error source " + error.source);
        console.log("download error target " + error.target);
        console.log("upload error code" + error.code);
    }
);

My problem is that I don't know what should be the file path to get to the root of my app ? And the major issue (which is the reason I've created this post) is that I read from within the doc that

It is also possible to download a file from remote and save it on the device (only iOS and Android).

Which is a problem to me ..

So what shold I do, can I just give the image url from the server to the src of my image in my phonegap app ? will that work ?

Thanks

Upvotes: 2

Views: 1747

Answers (1)

Jas
Jas

Reputation: 546

I generally use html tag to show images from my remote server in a phonegap app.

Upvotes: 2

Related Questions