Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not loading KingFisher photos when those files are url.isFileURL #62

Open
chrisvoronin opened this issue Jul 25, 2019 · 2 comments
Open

Comments

@chrisvoronin
Copy link

chrisvoronin commented Jul 25, 2019

KingFisher integration does not work with local files.

KF Integration source uses: KingfisherManager.shared.retrieveImage
However that does not use LocalFileProvider (king fisher) to load them which is needed for local files.

@chrisvoronin
Copy link
Author

chrisvoronin commented Jul 25, 2019

something along those lines fixes it:
I fixed it in my Form, with access I can push PR here.

if url.isFileURL {
            let local = LocalFileImageDataProvider(fileURL: url)
            
            AXDispatchUtils.executeInBackground { [weak self] in
                local.data(handler: { (result) in
                    switch result {
                    case .failure(let error):
                        AXDispatchUtils.executeInBackground { [weak self] in
                            guard let self = self else { return }
                            self.delegate?.networkIntegration(self, loadDidFailWith: error, for: photo)
                        }
                    case .success(let imageData):
                        let image = UIImage(data: imageData)
                        photo.image = image
                        AXDispatchUtils.executeInBackground { [weak self] in
                            guard let self = self else { return }
                            self.delegate?.networkIntegration(self, loadDidFinishWith: photo)
                        }
                    }
                })
            }
            return
        }

@alexhillc
Copy link
Owner

@chrisvoronin - thanks for the investigation! If you want contribute, you can fork the repo and then open a PR upstream.

Described here: https://help.github.com/en/articles/creating-a-pull-request-from-a-fork

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants