我一直在使用此代码将图像从 imageviewer 存储到设备内存。
blobObj = imageView.toImage();
var f = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory,'img.png');
f.write(blobObj);
Titanium.Media.saveToPhotoGallery(f,{
success: function(e) {
Titanium.UI.createAlertDialog({
title:'Photo Gallery',
message:'Check your photo gallery for image '
}).show();
},
error: function(e) {
Titanium.UI.createAlertDialog({
title:'Error saving',
message:e.error
}).show();
}
});
我想要的是从内存中获取当前保存图像的 native 路径
谢谢
最佳答案
亲爱的请参阅下面的示例以获取图像存储在钛中的 native 路径
文件系统
// Native path
var filename = "image.png";
// Create the file in the application directory
bgImage = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory, filename);
// Write the image to the new file (image created from camera)
bgImage.write(image);
// bgImage.nativePath, it is alos native path, but you can get through below code.
nativePath = Titanium.Filesystem.applicationDataDirectory + Ti.Filesystem.separator + filename;
alert(nativePath);
希望它适合你。它在我这边工作。
关于titanium-mobile - Titanium mobile 获取保存的图片路径,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14402709/