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

Dynamic properties of processors #110

Closed
kuyucakli opened this issue Feb 24, 2012 · 2 comments
Closed

Dynamic properties of processors #110

kuyucakli opened this issue Feb 24, 2012 · 2 comments

Comments

@kuyucakli
Copy link

I am not sure if that is the right place to ask, but i am in a hard situation that i need help. I have found issues #11 and #65
but i still need an exact answer.

In django admin side when saving the edit form i am getting image width and height values. And i need a way to pass that values to the processor. Is there an example on that?

@matthewwithanm
Copy link
Owner

Have you seen #108?

def get_processors(file, instance):
    return [Crop(width=instance.crop_width, height=instance.crop_height,
            x=instance.crop_x, y=instance.crop_y)]

class MyModel(models.Model):
    thumbnail = ImageSpecField(processors=get_processors, ...)

As we're discussing right now in #108, you still will need to manually invalidate the image when these properties change. You could use a post_save signal receiver or override save to do that.

Does that answer your question?

@kuyucakli
Copy link
Author

Thank you, problem solved :)

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