I am developing a phoneGap application in IOS where I use getPhoto('Camera.PictureSourceType.PHOTOLIBRARY');
to access the photo library and select an image. following is the onPhotoURISuccess method where I need to get the url of the image and pass it to my native plugin to validate it's filesize, resolution and file extension.
this is my getPhoto() method
// A button will call this function
function getPhoto(source)
{
// Retrieve image file location from specified source
navigator.camera.getPicture(onPhotoURISuccess, onFail, { quality: 100,
destinationType: navigator.camera.DestinationType.NATIVE_URI, sourceType: source });
}
and this is the onPhotoURISuccess method,
// Called when a photo is successfully retrieved
function onPhotoURISuccess(imageURI)
{
img_uri = imageURI;
console.log('NATIVE_URI==>'+img_uri);
// Get image handle
var imgPrev = document.getElementById('imgPreview');
// Unhide image elements
imgPrev.style.display = 'block';
// Show the captured photo
// The inline CSS rules are used to resize the image
imgPrev.src = imageURI;
}
I have three options for this according to the phoneGap documentation. using DATA_URL, FILE_URI or NATIVE_URI. FILE_URI seems to be hiding underlying data of the image where it always returns me a jpeg image thus the actual extension is hidden
assets-library://asset/asset.JPG?id=5CF16D20-9A80-483A-AC1C-9692123610B1&ext=JPG I want to know how to get the actual image name along with the extension from this.
I need to get the image name and validate the extension.
someone please do help me with posssible approach for me to follow
thanks in advance