2014-06-22 114 views
0
Ti.Media.openPhotoGallery({ 
    success:function(event) {     
attch = event.media;  
    }, 
    cancel:function(){ 
     console.log("error!"); 
    } 
}); 

我怎麼知道attch的重量?如果可能的話,庫中的文件的名稱。如何知道畫廊形象的重量?

+0

什麼是您正在使用的庫?你有沒有嘗試過event.media.width? – Pogrindis

回答

0

正如在文檔中提到的,方法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 
    } 
}); 
+0

減重。 –

+0

什麼?重量?你期望什麼價值? – 0101

+0

存儲卡中的wheight,以千字節或字節爲單位的值,在移動存儲器中的文件大小 –