1
我做了PhoneGap的應用程序,我採取這種方法的畫面:PhoneGap的圖像質量
// A button will call this function
//
function capturePhoto() {
// Take picture using device camera and retrieve image as base64-encoded string
//
navigator.camera.getPicture(onPhotoDataSuccess, onFail, {
quality : 50,
destinationType : destinationType.DATA_URL,
targetWidth: 100
});
}
但我想知道是否有在PhoneGap的辦法知道這是拍攝照片的重量。
是的,這是我用圖片做的。但同時我通過ajax發送給服務器,我需要知道圖像的重量。我試圖從服務器獲取base64圖片以在php中使用它。但是我還無法解碼照片。一旦我從PHP獲得照片,將更容易知道重量。 – cristina 2014-10-02 06:46:53
所以你要求在PHP中進行大小計算?你有沒有嘗試strlen(base64_decode($ encoded_data)); ? – HischT 2014-10-02 10:47:25
不,我想在發送到服務器之前知道照片的大小。 – cristina 2014-10-02 15:19:14