Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23421] Windows: Titanium.UI.ImageView, can not load image from blob.

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionDuplicate
Resolution Date2016-05-23T13:45:30.000+0000
Affected Version/sn/a
Fix Version/sRelease 5.4.0
ComponentsWindows
Labelsbase64decode, imageView, qe-5.4.0, windows
ReporterDee Clawson
AssigneeChristopher Williams
Created2016-05-16T17:16:40.000+0000
Updated2016-06-24T20:50:28.000+0000

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. !http://i.imgur.com/tzOkTIS.png!
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();
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

Comments

  1. Nazmus Salahin 2016-05-17

    Hello, I am able to reproduce this issue with following code. On Windows for this code image view is not loaded with the image. It is apparent that blob data is not supported in image property of ImageView but it is not mentioned in thedocumentation. *Code:*
       Titanium.UI.setBackgroundColor('#000');
       
       var win = Titanium.UI.createWindow({
       	title : 'Tab 1',
       	backgroundColor : '#fff'
       });
       
       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
       
       });
       
       win.add(theImage);
       
       win.open();
       
       
       
    Thanks *Environment*: *OS :* Microsoft Windows 8.1 Enterprise N *Device info:* Microsoft Lumia 640 (Windows Phone 8.1) *Node.js Version:* 0.12.7 *npm Version:* 2.11.3 *Titanium SDKs:* 5.3.0.v20160404105211 *Java Development Kit Version:* 1.8.0_73 *Titanium CLI Version:* 5.0.5 *Appcelerator CLI Version:* 5.2.2 *Appcelerator Studio:* 4.5.0
  2. Christopher Williams 2016-05-23

    This is a duplicate of TIMOB-23273 - the fix is already on the master branch. You can try it out with appc ti sdk install -b master
  3. Josh Longton 2016-06-24

    Closing as a duplicate of TIMOB-23273. Tested on: Microsoft Lumia 640 (8.1) Windows Simulator (8.1) Microsoft Lumia 640 (10) Windows Simulator (10) Windows 10 Pro Studio: 4.7.0.201606150733 Ti SDK: 5.4.0.v20160617074028 Appc NPM: 4.2.7-2 App CLI: 5.4.0-18 Node v4.4.4 *Closing Ticket.*

JSON Source