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

Incompatible with CarrierWave::Backgrounder #8

Open
marckohlbrugge opened this issue Nov 24, 2014 · 2 comments
Open

Incompatible with CarrierWave::Backgrounder #8

marckohlbrugge opened this issue Nov 24, 2014 · 2 comments

Comments

@marckohlbrugge
Copy link

Would you consider making this gem compatible with CarrierWave Backgrounder and Delayed::Job?

The gem currently doesn't work with those, because it relies on virtual attributes as defined in crop_uploaded. These attributes are not persisted and since Delayed Job simply stores/retrieves the object by its ID these values will not be available when the processing happens.

I see two solutions for this:

One is solution is adding additional methods to ActiveRecord to serialize these virtual attributes for Delayed Job. This solution is described here, but doesn't seem particularly elegant.

The other solution is to actually store the crop attributes in the database, rather than using virtual attributes. This way the attributes persist and are available to the Delayed Job worker. The attributes can be set to nil once processing is completed so cropping? will only be true if the attributes are set again.

I've been able to make some progress on implementing the latter solution, but I'm still not 100% there yet. For some reason the images are only cropped when a new image is uploaded, but not when the crop attributes are changed.

Any suggestions on how to make it work, or how to debug it?

@marckohlbrugge
Copy link
Author

Did some more digging and apparently since I'm using For (S3 cloud storage) things get a little bit tricker. After adding the code linked in that article though, I still haven't been able to successfully fire recreate_versions except for new uploads.

@kirtithorat
Copy link
Owner

@marckohlbrugge My apologies for late reply. I am working on issue #3 and it will provide the option to specify and save the crop attributes in database. Will that work for you? Also, were you able to solve the issue with S3? Let me know.

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