carrierwave_backgrounder icon indicating copy to clipboard operation
carrierwave_backgrounder copied to clipboard

.recreate_versions! and .recreate_versions!(:version) doesn't work. But correctly work without carrierwave_backgrounder

Open devishot opened this issue 12 years ago • 2 comments

TestUploader: include ::CarrierWave::Backgrounder::Delay include CarrierWave::MiniMagick storage :fog process :resize_to_fit => [400, 500] version :huge do process :resize_to_fill => [200, 300] end version :small do process :resize_to_fill => [100, 100] end

User: mount_uploader :test, TestUploader field :test_tmp, type: String #CarrierWaveField store_in_background :test

Rails console: u = User.first u.remote_test_url = "http://d1.../sailor_1x.jpg" => "http://d1.../sailor_1x.jpg" u.test.recreate_versions!(:huge) => nil u.save!

all files were updated (sailor_1x.jpg, huge_sailor_1x.jpg, small_sailor_1x.jpg), but but only one version (huge_sailor_1x.jpg) should be was updated.

u.remote_test_url = "http://s.../qwe.jpg" => "http://s.../qwe.jpg"
u.test.recreate_versions! => [:store_versions!]
u.save!

nothing was updated! (sidekiq job finished after 0.004 sec)
in CarrierWave without carrierwave_backgrounder recreate_versions!(:version) and recreate_versions! are work correctly.

How can i update only one version in background?
https://github.com/lardawge/carrierwave_backgrounder/issues/23#issuecomment- 3767550 Do i need write additional background job for recreate_versions!(:version)?

devishot avatar Nov 17 '13 08:11 devishot

I also deactivated carrierwave_backgrounder because It wouldn't work with post-processing the files (in my case cropping/resizing of images).

Would be great if this was possible with carrierwave_backgrounder

toxin20 avatar Jun 08 '14 15:06 toxin20

@devishot See this comment: https://github.com/lardawge/carrierwave_backgrounder/issues/23#issuecomment-3767550

Try this in your rails console instead

u = User.first
u.remote_test_url = "http://d1.../sailor_1x.jpg"
=> "http://d1.../sailor_1x.jpg"
u.process_ test_upload = true
u.test.recreate_versions!(:huge)
=> nil
u.save!

If you need to do it in a background job, see the comment above on the link provided.

leifcr avatar Nov 03 '14 20:11 leifcr