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
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 ofImageView
but it is not mentioned in thedocumentation. *Code:*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
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
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.*