我在拯救與Appcelerator的照片有點麻煩。調整尺寸照片Appcelerator的鈦前保存
我拍照並保存它,沒關係,那是工作,這裏是代碼:
var cameraOverlay = Ti.UI.createView({
width:'100%',
height:'100%'
});
var porcoOverlay = Ti.UI.createView({
width: '90%',
height: '100%',
left: 0,
top: 0
});
var porco = Ti.UI.createImageView({
width: 200,
height: 238,
top: 10,
left: 10,
image:'images/pig.png',
touchEnabled: false
});
porcoOverlay.add(porco);
cameraOverlay.add(porcoOverlay);
var menuOverlay = Ti.UI.createView({
width: '10%',
height: '100%',
right: 0,
top: 0
});
var takeFoto = Ti.UI.createButton({
title: 'PH',
bottom: 10,
right: 10
});
menuOverlay.add(takeFoto);
cameraOverlay.add(menuOverlay);
Ti.Media.showCamera({
showControls:true,
overlay: cameraOverlay,
saveToPhotoGallery: true,
success:function(event) {
var cropRect = event.cropRect;
var image = event.media;
var f = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'camera_photo.png');
f.write(image);
}
});
takeFoto.addEventListener('click',function(){
Ti.Media.takePicture();
});
這裏是我的問題:
1 - 自動對焦無法正常工作;
2 - 圖像分辨率始終是:320 * 240;
3 - 我想加入覆蓋有照片並保存;
任何人都可以幫助我嗎?
謝謝!但我試圖把這段代碼放在成功回調中,將模塊插入到正確的文件夾中,但沒有生效。圖像仍然是320 * 240,但我想用我的5MP相機拍攝高質量的照片。我以前從未與圖片合作過,所以我真的迷失了! –
@almeida檢查您的設備相機設置。什麼是你的像素尺寸... – MRT
這是星系聯繫,有500萬像素的相機!但使用覆蓋層時,照片始終爲320 * 240,如果我取下覆蓋層,相機會以5MP和自動對焦的方式拍攝普通照片。 –