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

Windows: Titanium.UI.ImageView, can not load image from blob.

    Details

      Description

      Problem

      We dynamically create images in our applications. In iOS & Android we create the blob and assign it to the image view. This does not work in Windows 8.1 or 10. The documentation http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.ImageView states that this feature is unavailable for Web, but makes no mention of Windows. The expected functionality is that we should be able to assign a blob to an image view Windows as we do iOS & Android. We have found a work around by saving the blob to disk and then opening it but we do not feel that is an acceptable solution considering the amount of drawables we create.

      Test case

      The code below will display image inside of a view. This is working on iOS & Android, but not windows.

      index.js

      var newView = Titanium.UI.createView({
          backgroundColor: "#9f9ab5",
          width: 200,
          height: 200,
          top: 10,
      });
       
      var encodedImage = 'R0lGODdhUwBTAIAAAAAAAP///ywAAAAAUwBTAAAC/4yPqcvtD6OctNqLs968PwCG4kgeZGiC08mWSwurRpsCa0y/OFu7ASrZ8XS2oOw3jACRReUxsYQsc85m9PNEXB3TpPS4bYSZvVHtPDOnrWry2jfuntBuprzMzsOzdOr9DRYo0pcUJ7inJ6jgd9hmmDi4hkeH92fnyCcJGFmHuFjYyPlYqVjhqXkpmtkJ2nSjmkcaSyRLaQRLOIcKtUq7u0lly7U65lsn6yMsRtz7Oasl5PzKIKTL+mxZnQytnV16jRxD3e2N/U1e7LFl6dG+7Iqa7t6+/j3vXG/9Hg5/Hcydb5sxHNKAteHFqRYWSALl/CtYZdIvIgQnjuu3b5MyhP8Vjw3DeFGiR4riLAJsJS/Vw4bNTloTiK+kS4gLGSW82FHkRog542FieJBjS4defOIyeHPmR348fzLF2VIY0X5TM6ZSaDVXPp0IRT7sCvZqWJhGp45aGBOkWHBjh0YN2OvUSHbGsmqEao6qvYhC1abkuhYDXL9RAZOd1tfux8EbOqakSzLvLZtfnr0rN7lV5Z1e93aGITUUuVx4n84V3Y10ZNNbkVZTfQ9z4tJ3Y5/jcxjR3wuyla6u3fd1zWhlC7sUvpi4P+P8vgaXWZXC7uUvQ10OqtiqY+t4d0836xT4c7Vtq0NKm3Yl9uJHA4tXWdS91vDyWe5AP1Dz7OO4UVth5oYVY+M1ZV5ISIWWlHpA/TdfexkcBpuB8DFoAYRGoXWgSdKtVx6GfE3YYHR1jbhUhtSJSBOJ2ukH4nucTbgdaK71lyCH6PgHXo06PjLajAsK6Ns9Qg5JZJFGHolkku0UAAA7';
      var decodedImage = Ti.Utils.base64decode(encodedImage);
       
      var theImage = Ti.UI.createImageView({
          image: decodedImage,
          width: 100,
          height: 100,
          right: 50
      });
       
      newView.add(theImage);
       
      $.index.add(newView);
       
      $.index.open();
      

      unacceptable_work_around.js

      var newView = Titanium.UI.createView({
          backgroundColor: "#9f9ab5",
          width: 200,
          height: 200,
          top: 10,
      });
       
      var encodeImage = 'R0lGODdhUwBTAIAAAAAAAP///ywAAAAAUwBTAAAC/4yPqcvtD6OctNqLs968PwCG4kgeZGiC08mWSwurRpsCa0y/OFu7ASrZ8XS2oOw3jACRReUxsYQsc85m9PNEXB3TpPS4bYSZvVHtPDOnrWry2jfuntBuprzMzsOzdOr9DRYo0pcUJ7inJ6jgd9hmmDi4hkeH92fnyCcJGFmHuFjYyPlYqVjhqXkpmtkJ2nSjmkcaSyRLaQRLOIcKtUq7u0lly7U65lsn6yMsRtz7Oasl5PzKIKTL+mxZnQytnV16jRxD3e2N/U1e7LFl6dG+7Iqa7t6+/j3vXG/9Hg5/Hcydb5sxHNKAteHFqRYWSALl/CtYZdIvIgQnjuu3b5MyhP8Vjw3DeFGiR4riLAJsJS/Vw4bNTloTiK+kS4gLGSW82FHkRog542FieJBjS4defOIyeHPmR348fzLF2VIY0X5TM6ZSaDVXPp0IRT7sCvZqWJhGp45aGBOkWHBjh0YN2OvUSHbGsmqEao6qvYhC1abkuhYDXL9RAZOd1tfux8EbOqakSzLvLZtfnr0rN7lV5Z1e93aGITUUuVx4n84V3Y10ZNNbkVZTfQ9z4tJ3Y5/jcxjR3wuyla6u3fd1zWhlC7sUvpi4P+P8vgaXWZXC7uUvQ10OqtiqY+t4d0836xT4c7Vtq0NKm3Yl9uJHA4tXWdS91vDyWe5AP1Dz7OO4UVth5oYVY+M1ZV5ISIWWlHpA/TdfexkcBpuB8DFoAYRGoXWgSdKtVx6GfE3YYHR1jbhUhtSJSBOJ2ukH4nucTbgdaK71lyCH6PgHXo06PjLajAsK6Ns9Qg5JZJFGHolkku0UAAA7';
      var decodedImage = Ti.Utils.base64decode(encodeImage);
      var fileName = 'test' + '.gif';
      var imageFile = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, fileName);
      imageFile.write(decodedImage);
       
      var theImage = Ti.UI.createImageView({
          image: imageFile.nativePath,
          width: 100,
          height: 100,
          right: 50
      });
       
      newView.add(theImage);
       
      $.index.add(newView);
       
      $.index.open();
      

      Logs

      Discussions

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                cwilliams Christopher Williams
                Reporter:
                kdclaw3@gmail.com Dee Clawson
              • Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

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

                    Git Source Code