Problem
After taking a picture in android with the code below the application creates 2 files in the next path:
/sdcard/DCIM/camera/
One of them is named with the initials tiaxxx.jpg
Reproducible steps:
1. Run the code below
2. Take a picture
3. Go to the next path: /sdcard/DCIM/camera/
Notice that in the above path is created a file with the name of tiaxxx.jpg
Expected behavior:
Customer does not want to have another image stored with the name Tiaxxxx.jpg in the next path: /sdcard/DCIM/camera/
More info:
I use saveToPhotoGallery:false too, but it's the same expected behavior.
Sample code:
var mwin = Ti.UI.createWindow({
backgroundColor : 'orange'
});
var btnShowCamera = Ti.UI.createButton({
title : 'Take picture',
width : 150,
height : 70,
top : 50
});
mwin.add(btnShowCamera);
btnShowCamera.addEventListener('click', function(e)
{
Titanium.Media.showCamera(
{
mediaTypes : Titanium.Media.MEDIA_TYPE_PHOTO,
allowEditing : true,
saveToPhotoGallery:true,
success : function(event)
{
//var cropRect = event.cropRect;
var image = event.media;
var imageView = Titanium.UI.createImageView(
{
image : image,
width : 480,
height : 640
});
image = imageView.toBlob();
if(Titanium.Filesystem.isExternalStoragePresent())
{
var photoDir = Titanium.Filesystem.getFile(Titanium.Filesystem.externalStorageDirectory, 'PlayGroundPhotos');
if(!photoDir.exists())
{
photoDir.createDirectory();
}
}
var photoPath = photoDir.nativePath;
var f = Titanium.Filesystem.getFile(photoPath, 'tony.jpg');
f.write(image);
},
cancel : function()
{
},
});
});
mwin.open();
Helpdesk
APP-344567
Similar behavior observed. Duplicate images with different file names are stored in gallery. code:
Setting saveToPhotoGallery to true will automatically save the image in device photo gallary. If I set this to false, I don't see the extra file getting created. Tested with SDK 3.1.0 using Google Nexus.
Closing ticket as the issue cannot be reproduced.