How to get selected image information with camera plugin


I am using cordova camera plugin to choose image from user, user can opt for either camera or from photo library options so i am able to get the selected image in base64 string, is there any options or any way to get the details of selected image information such as size(when we calculate the size with base 64 string length we are not getting original size), image format(as we are getting base64 string we don’t whether user selected gif/JPEG.
I need to implement the functionality to restrict the user uploading images with size and image format. If there is a any other options other than camera plugin please suggest.

Thank you.

function takePhoto() {, onError, { quality: 50,
        sourceType: });

function gotPhoto(imageUri) {
    window.resolveLocalFileSystemURI(imageUri, function(fileEntry) {
        fileEntry.file(function(fileObj) {
            console.log("Size = " + fileObj.size);

watch the accepted answer at SO.

1 Like