Titanium Community Questions & Answer Archive

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

Save Remote ImageView from ScrollableView to the Photo Gallery

Hey guys, does anyone know how to save a remote ImageView from a ScrollableView to the Photo Gallery? I was thinking I would have to use xhr, but it seems that there should be an easier way, since the image is already loaded in an ImageView.

— asked December 2nd 2010 by Arlton Lowry
  • gallery
  • image
  • imageview
  • photo
  • photogallery
  • remote
  • scrollableview
  • view
  • xhr
0 Comments

2 Answers

  • Accepted Answer

    var f = Titanium.UI.ImageView.toBlob('+scrollView.currentPage+');

    Should be

    var f = view13.toBlob('+scrollView.currentPage+');

    — answered December 4th 2010 by Aaron Saunders
    permalink
    4 Comments
    • I was able to get it working with this:

      var f = view13.toImage();
      Titanium.Media.saveToPhotoGallery(f);
      

      — commented December 4th 2010 by Arlton Lowry
    • BTW, thanks again for your help. I really appreciate it.

      — commented December 4th 2010 by Arlton Lowry
    • you should make the answer as accepted so other know it has been resolved by the star next to it

      — commented December 5th 2010 by Aaron Saunders
    • Hi guys,

      I tested toBlob and toImage(). If i use toBlob() i only get the image. If i use toImage() i get the view. And the transparency is white.

      So i use the toBlob();

      — commented February 12th 2012 by Maarten Dreves
  • try this

    Titanium.UI.ImageView.toBlob

    the once you get the blob, save to gallery

    Titanium.Media.saveToPhotoGallery

    — answered December 2nd 2010 by Aaron Saunders
    permalink
    2 Comments
    • This is what I have so far for the ImageView that is used in the scrollableView:

      var view13 = Ti.UI.createImageView({
          image:'http://www.example.com/files/photo/001.jpg',
          height:1024,
      });
      

      This is what I have for saving the file to the Photo Gallery:

      savedialog.addEventListener('click', function(e) {
      if (e.index == 0) {
      var f = Titanium.UI.ImageView.toBlob('+scrollView.currentPage+');
      Titanium.Media.saveToPhotoGallery(f);
      

      I still can't seem to get it to function properly. I'm not getting any errors except for the console telling me: message = "Result of expression 'Titanium.UI.ImageView' [undefined] is not an object.";

      You were correct about converting the ImageView to a Blob. Thank you for your help. I really appreciate it.

      — commented December 2nd 2010 by Arlton Lowry
    • Sorry took so long to respond

      — commented December 4th 2010 by Aaron Saunders
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.