How to get the file after using photo library


#1

Hi All,

I am using photo library to retrieve photo and get this.

{“id”:“12;/storage/emulated/0/IMG_20180502_224855.jpg”,“fileName”:“IMG_20180502_224855.jpg”,“width”:480,“height”:480,“creationDate”:“2018-05-02T23:20:37.000Z”,“latitude”:0,“longitude”:0,“albumIds”:[“1389444597”],“thumbnailURL”:“cdvphotolibrary://thumbnail?photoId=12%3B%2Fstorage%2Femulated%2F0%2FIMG_20180502_224855.jpg&width=512&height=384&quality=0.5”,“photoURL”:“cdvphotolibrary://photo?photoId=12%3B%2Fstorage%2Femulated%2F0%2FIMG_20180502_224855.jpg”},

My question is how to get the photo file object from it. I try to get file path and file name from id , file path is :/storage/emulated/0/, file name is : IMG_20180502_224855.jpg, and then try to read it using file plugin like

file.readAsDataURL(fileInfo.fileDir,fileInfo.fileName).then(…), but got encoding error,

I also tried to using file.resolveLocalFilesystemUrl(image.photoURL), but got the same error.

Please help how to get the file object, thanks.


#2

anyone help??? thanks.


#3

You can use the Camera plugin to get photos from your library

See my post in this topic: Camera plugin is working or not
Should help you in the right direction