Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Storing remote images locally

I'm looking for a solution to store remote images (URLs retrieved from a RSS-feed) into the local file system so the images can be displayed in offline-mode too.

Is there any solution for that with Titanium?

— asked May 31st 2010 by New Identity AG
  • download
  • local
  • storage
0 Comments

2 Answers

  • Kitchen Sink has a couple of examples that show how to do this. In particular, you could look at xhr_binarydata.js.

    Here's an example:

    var xhr = Titanium.Network.createHTTPClient();
    var dir = Ti.Filesystem.applicationDataDirectory;
    xhr.onload = function()
    {
        var f = Ti.Filesystem.getFile(dir,'ti.png');
        f.write(this.responseData);
        imageView.url = f.nativePath;
    };
    xhr.open('GET','http://yourpath');
    xhr.send();
    

    fetches a remote PNG file and stores into a file. then loads the image view from the files path.

    — answered May 31st 2010 by Jeff Haynie
    permalink
    0 Comments
  • regarding image storage, can we also store the rss feeds images and their pertaining texts locally in android?
    so that if the mobile has no network connection, it shall take from cache or db ?

    — answered February 18th 2012 by Talal Manaa
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.