Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-25282

Windows: saveToPhotoGallery throws exception

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: Release 6.1.2, Release 7.0.0, Release 6.2.0
    • Fix Version/s: Release 7.0.0
    • Component/s: Windows
    • Labels:
      None
    • Environment:

      Ti SDK: 6.1.2.GA, 6.2.0.v20170912203804, 7.0.0.v20170906135653

    • Story Points:
      5
    • Sprint:
      2017 Sprint 20 SDK

      Description

      Description

      Calling Ti.Media.saveToPhotoGallery() throws the following error, running through VS gives more detail and I believe the cause is to_path here is null, so the to convert string call is returning an empty string, which then causes an error in the copy call. I believe this is because the Library folders are virtualized read here so they don't have a path, we might need to do something like this to first find the folder for a user, then write to that folder

      [ERROR] ----- Titanium Javascript Runtime Error -----
      [ERROR] In app.js: 14,28
      [ERROR] Message: Uncaught Error: saveToPhotoGallery: unknown exception
      

      var win = Ti.UI.createWindow();
      var view = Ti.UI.createView({
          backgroundColor: 'red',
          width: 400,
          height: 400,
          borderRadius: 200
      });
      win.add(view);
      win.open();
      var file = Ti.Filesystem.getFile('Logo.png')
      Ti.Media.saveToPhotoGallery(file, {
          success: function (e) {
              // log.args('Ti.Media', 'Image saved to photo-gallery successfully!');
              console.log('image done');
          },
          error: function (e) {
              // log.args('Ti.Media', 'Error saving image to photo-gallery: ' + e.error);
              console.log(JSON.stringify(e))
              console.log('image ');
          }
      });
      

      Steps to reproduce
      1. Add the above to an existing app.js and build for Windows
      Actual

      Error thrown

      Expected

      Image should be written to gallery

        Attachments

          Activity

            People

            • Assignee:
              kiguchi Kota Iguchi
              Reporter:
              eharris Ewan Harris
              Reviewer:
              Gary Mathews
              Tester:
              Ewan Harris
            • Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-11143
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Source Code