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

pre-completion block feature idea? #326

Closed
shams-ahmed opened this issue May 24, 2016 · 4 comments
Closed

pre-completion block feature idea? #326

shams-ahmed opened this issue May 24, 2016 · 4 comments

Comments

@shams-ahmed
Copy link

Current implementation only has completion block once the image has been applied, what do you reckon of execution another block just before applying a image.

one use-case i have is changing the contentMode before i set the new image. with the current methods it's not possible.

Another possible solution could be to use KingfisherOptionsInfoItem with set contentMode?

What your thoughts? am happy to start a PR with this feature...

@onevcat
Copy link
Owner

onevcat commented Aug 7, 2016

As #320
Feature in plan.

@onevcat
Copy link
Owner

onevcat commented Sep 14, 2016

Implemented in Kingfisher 3. Check ImageProcessor for more.

@onevcat onevcat closed this as completed Sep 14, 2016
@lucasecf
Copy link

Hi @onevcat @shams-ahmed , I came across this issue because I want to implement the same user case as first mentioned in the description.

Checking the suggestion, I understand that the ImageProcessor's process method is invoked before the image is set, but changing the contentMode is an operation in the imageView, not in the image itself. Is there any cleaner way to achieve this result? Only thing I came across so far is creating this custom processor:

struct TestProcessor: ImageProcessor {
        let imageView: UIImageView

        var identifier: String {
            return "test.processor"
        }

        func process(item: ImageProcessItem, options: KingfisherOptionsInfo) -> Image? {
            imageView.contentMode = .scaleAspectFill
            return DefaultImageProcessor.default.process(item: item, options: options)
        }
    }

@onevcat
Copy link
Owner

onevcat commented Nov 28, 2017

@lucasecf Maybe it worth to check #810, although it is not implemented yet.

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

No branches or pull requests

3 participants