Ti.Media.openPhotoGallery({
success:function(event) {
attch = event.media;
},
cancel:function(){
console.log("error!");
}
});
我怎麼知道attch的重量?如果可能的話,庫中的文件的名稱。如何知道畫廊形象的重量?
Ti.Media.openPhotoGallery({
success:function(event) {
attch = event.media;
},
cancel:function(){
console.log("error!");
}
});
我怎麼知道attch的重量?如果可能的話,庫中的文件的名稱。如何知道畫廊形象的重量?
正如在文檔中提到的,方法success
將返回一個包含屬性爲media
的對象,該對象是Blob格式的圖像/視頻。如果您想知道圖像的寬度,請執行以下操作:
Ti.Media.openPhotoGallery({
success: function(event) {
var image = event.media;
console.log(image.width);
console.log(image.size); // image size in bytes
}
});
什麼是您正在使用的庫?你有沒有嘗試過event.media.width? – Pogrindis