Project: titanium
Issue TIMOB-17626: Ti.Media.saveToPhotoGallery() saves pictures without file extension on Android
h4. Problem Description On Android, *Ti.Media.saveToPhotoGallery()* saves a file or a blob without any file extension, which makes it impossible for the photo gallery to recognize the file. The issue can be reproduced with the following code, with the picture test.jpg being stored in project/app/assets. Note that in this example, I use *Ti.Media.saveToPhotoGallery* with a blob but I get exactly the same result with a file. {code:javascript} var file = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, "/test.jpg"); Ti.Media.saveToPhotoGallery(file.read(), {	success: function() {	alert('success');	},	error: function() {	alert('error');	} }); {code} I receive a success, but the image is saved without extension and I get this message in the console: D/MediaScannerReceiver(25405): action: android.intent.action.MEDIA_SCANNER_SCAN_FILE path: /storage/emulated/0/Pictures/TestApp/tia636479782jpeg h4. Steps to Reproduce: 1. Create a Classic project. 2. Paste this code in app.js file. 3. Paste a photo to the resources folder named test.jpg. 4. Run this code with the testing environment. h3.Test Code: {code:title=app.js} var win = Titanium.UI.createWindow({	backgroundColor : "#000", }); var photo = Ti.UI.createButton({	title : 'Save Photo',	height : Ti.UI.SIZE,	width : Ti.UI.SIZE,	top : 20,	color : "#fff" }); win.add(photo); // Listen for click events. photo.addEventListener('click', function() {	file = Ti.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory, "test.jpg");	alert(file.nativePath);	Ti.Media.saveToPhotoGallery(file.read(), {	success : function() {	alert('success');	},	error : function() {	alert('error');	}	}); }); win.open(); {code}
Story points: 3