Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23115] Windows: ImageView.image doesn't handle Ti.File/Blob

GitHub Issuen/a
TypeImprovement
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2016-03-31T12:42:39.000+0000
Affected Version/sRelease 5.2.0
Fix Version/sRelease 5.4.0
ComponentsWindows
Labelsfilesystem, image, windows_phone
ReporterZakhar Zhuravlev
AssigneeKota Iguchi
Created2016-03-27T04:51:29.000+0000
Updated2016-06-30T15:01:14.000+0000

Description

It's affected 5.2.0. Tested on emulator and on real device (same behaviour) What doing this sample app: copy .png file from Resources folder to dataDirectory and try to set copied image to imageView; *index.js:*
var directory = (Ti.Filesystem.isExternalStoragePresent()) ? Ti.Filesystem.externalStorageDirectory : Ti.Filesystem.applicationDataDirectory;
var fileIndex = 0;
var toFile;

function listFiles() {
    if(OS_WINDOWS) {
    	alert(Ti.Filesystem.getFile(directory).getDirectoryListing());
    } else {
    	console.warn(Ti.Filesystem.getFile(directory).getDirectoryListing());	
    }    
}

function copyFile() {
	fileIndex++;
	var fromFile = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, "test.png");
	toFile = Ti.Filesystem.getFile(directory, '' + fileIndex + '.png');
	toFile.write(fromFile.read());
}
function onImageClick() {
	$.imageView.image = toFile;
        // below another approaches
        // $.imageView.image = toFile.read();
        // $.imageView.image = toFile.nativePath;
        // $.imageView.image = directory + '/' + fileIndex + '.png';
}

$.win.open();
*index.xml:* {noformat}

Comments

  1. Rene Pot 2016-04-29

    Is there any way this issue can be merged into 5.3?
  2. Ewan Harris 2016-06-30

    Verified using: Windows 10 Pro Ti SDK: 5.4.0.v20160629063537 Appc NPM: 4.2.7-2 Appc CLI: 5.4.0-23 Appc Studio: 4.7.0.201606220541 Lumia 930: 10.0 Lumia 520: 8.1 The image property of imageview can now be set using Ti.File or a blob. Closing ticket

JSON Source