Titanium Community Questions & Answer Archive

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

How to display images in imageView with base64 data

I have a server sending images to my client in base64. How (and) can I display them in imageView.

— asked June 22nd 2010 by Marko Perutovic
  • base64
  • images
  • imageview
  • mobile
0 Comments

2 Answers

  • you can use : https://developer.appcelerator.com/apidoc/mobile/1.3/Titanium.Utils

    base64decode

    — answered June 22nd 2010 by Stephane Pelamourgues
    permalink
    0 Comments
  • Found out now that it works in 1.3.2 (1.4 RC1).
    Ti.Utils.base64decode - in this version returns TiBlob instead of text and it works just fine.
    Here a sample:

    var xdom = xml.documentElement;
    var picture = Titanium.Utils.base64decode(xdom.getElementsByTagName('ServerPicture').item(0).text);
    row1Image.image = picture;

    — answered June 22nd 2010 by Marko Perutovic
    permalink
    1 Comment
    • I have some images files in my local file system. I am trying to convert image file into base64 data using Titanium Utils. But after the conversion I am getting empty string… here is my sample code

      var f = Titanium.Filesystem.getFile(currIamge);
      var temp = f.read();
      var encodeData = Ti.Utils.base64encode(temp);
      alert("encodeData = "+encodeData);
      

      Here I am getting empty alert. How do I convert a file into base64 data? I am Using Titanium 1.7.5 in iOs platform

      — commented February 16th 2012 by Karthi Ponnusamy
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.