kmorkos / flutter_photokit

Flutter plugin to interact with iOS PhotoKit
Other
8 stars 15 forks source link

Return saved album path #1

Closed aravindhkumar23 closed 5 years ago

aravindhkumar23 commented 6 years ago

Hi @kmorkos

The Plugin helps me a lot. I am trying to return the saved path (i have used save to album) so that I will use the same URL to render in the image view instead of returning the boolean value.

PHImageManager().requestImage(for: fetchResult!, targetSize: CGSize.init(), contentMode: PHImageContentMode.default, options: PHImageRequestOptions?.init(nilLiteral: ()), resultHandler: { (image:UIImage!,some:Any?) in
                            print("printing url *********--->>>>")
                            print(image)
                    })

my print statement is here

printing url *****--->>>> some(<UIImage: 0x1c42ad440> size {90, 120} orientation 0 scale 1.000000)

any Idea to return the path of the image I have been looking to do this for a long time

kmorkos commented 6 years ago

AFAIK you can't access the file path directly from the camera roll (unless using UIImage natively). The only way to access the file from Flutter is to copy it to the application/temporary directory and use that filepath in Flutter. You can take a look at the code for the image_picker plugin for an example of how you would do this.

However, if you're adding the photo to the device's album from within your app, I'm assuming you already have access to the original photo so you probably wouldn't want to go down this route.