使用默认相机拍摄后如何直接从 iPhone 上传照片?
目前我使用以下逻辑(Appaccelerator)存储照片:
<script language="JavaScript">
var medium = {};
Rf.media.push(medium);
medium.title = 'Photo';
medium.extension = 'jpg';
medium.create = function () {
var medium = this;
Ti.Media.showCamera({
// TODO: disallow video for ios
saveToPhotoGallery: false,
showControls: true,
success: function (media_item) {
var name = Rf.util.timestamp()+'.'+medium.extension;
write_to_new_file(name, media_item.media, function (file) {
});
},
});
};
medium.view = function (file) {
var photoView = Ti.UI.createImageView({
image: file,
});
var photoWindow = Ti.UI.createWindow({
backgroundColor: Rf.style.backgroundColor,
color: Rf.style.foregroundColor,
layout: 'vertical',
modal: true,
});
photoWindow.add(photoView);
photoWindow.open();
};