0
剛想相機圖片一個疑問(的iOS /安卓/窗)相機圖像格式/擴展(的iOS /安卓/窗)
//take a picture
Ti.Media.showCamera({
saveToPhotoGallery:false,
success:function(event) {
if(event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {
$.preview.image = event.media;
//insert on attachments table
database.insert('attachments',{
name:'test',
extension:'',
file:Ti.Utils.base64encode(event.media).toString()
});
}
}
});
當我將圖片發送到我的後臺,我也需要在發送文件擴展名,但沒有文件,只有我保存在本地SQLite表中的編碼圖片的字符串。
如何得到這個擴展名,或者它需要將圖像保存在應用程序目錄中?
謝謝,當我運行任何SQLite查詢時,我將它記錄到控制檯,在這種情況下,轉換爲字符串的編碼圖像的日誌在每行的開頭都有\ n,這是正確的我做錯了什麼? –
\ nUAUEAEaBAAECBAgkExAAJGu4cgkQIECAQBUQABgFAgQIECCQTEAAkKzhyiVAgAABAlVAAGAU \ nCBAgQIBAMgEBQLKGK5cAAQIECFQBAYBRIECAAAECyQQEAMkarlwCBAgQIFAFBABGgQABAgQI \ nJBMQACRruHIJECBAgEAVEAAYBQIECBAgkExAAJCs4colQIAAAQJVQABgFAgQIECAQDIBAUCy \ nhiuXAAECBAhUAQGAUSBAgAABAskEBADJGq5cAgQIECBQBQQARoEAAQIECCQTEAAka7hyCRAg \ nQIBAFRAAGAUCBAgQIJBMQACQrOHKJUCAAAECVUAAYBQIECBAgEAyAQFAsoYrlwABAgQIVAEB \ ngFEgQIAAAQLJBAQAyRquXAIECBAgUAUEAEaBAAECBAgkExAAJGu4cgkQIECAQBUQABgFAgQI \ nECCQTEAAkKzhyiVAgAABAlVAAGAUCBAgQIBAMgEBQLKGK5cAAQIECFQBAYBRIECAAAECyQQE \ nAMkarlwCBAgQIFAFBABGgQABAgQIJBMQACRruHIJECBAgEAVEAAYBQIECBAgkExAAJCs4col –
與解決:IMG = img.replace(/(\ r \ n | \ n | \ R)/克, 「」); –