Implementing phonegap's Capture.getFormatData() method