8

私はAWS S3に画像をアップロードするRMagicでcarrierwave 0.10.0宝石を使用していました。 AWS S3にアップロードするには時間がかかっていた以外はすべてうまくいっていました。したがって、バックグラウンドで画像をアップロードするために搬送波バックグラウンドを使用すると考えられました。私はcarrierwave backgrounder(0.4.2)を設定しましたが、この1つでは、私の元のファイルは常にS3にアップロードされますが、そのイメージのバージョンはS3でアップロードされることはありません。ここでCarrierWaveの背景説明は、AWS S3へのバージョンの画像をアップロードしていない

は私carrierwave_backgrounder.rb

CarrierWave::Backgrounder.configure do |c| 
    c.backend :sidekiq, queue: :carrierwave 
end 

である私は

Sidekiq.configure_server do |config| 
config.redis = { :url => "redis://#{ENV['REDIS_ENDPOINT']}:6379", :namespace=> "#{ENV['REDIS_NAMESPACE']}" } 
config.options = 
queues: %w{ 
    critical 
    carrierwave 
    } 
}) 
end 

sidekiq.rbで私のキューを定義している。ここに私photo_uploader.rbここ

class PhotoUploader < CarrierWave::Uploader::Base 
    include ::CarrierWave::Backgrounder::Delay 
    include CarrierWave::RMagick 
    storage :fog 

    def store_dir 
    "uploads/images/" 
    end 

    def filename 
    "#{secure_token}.#{file.extension}" if original_filename.present? 
    end 

    def orient_image 
    manipulate! do |img| 
     img.auto_orient 
     img 
    end 
    end 

    # Create different versions of your uploaded files: 
    version :thumb_small do 
    process :resize_to_fill => [100,100] 
    process :strip 
    end 

    def strip 
    manipulate! do |img| 
     img.strip! 
     img = yield(img) if block_given? 
     img 
    end 
    end 

    def extension_white_list 
    %w(jpg jpeg gif png) 
    end 

    def get_version_dimensions 
    model.width, model.height = `identify -format "%wx%h " #{file.path}`.split(/x/) 
    end 

    protected 
    def secure_token 
     var = :"@#{mounted_as}_secure_token" 
     model.instance_variable_get(var) || model.instance_variable_set(var, SecureRandom.hex(5)) 
    end 
end 

は私のプロフィールです.RBファイル

私はIMAGE_URLだけのオリジナル画像がアップロードされてアップロードすると、私は、このコマンド

bundle exec sidekiq -d -L log/sidekiq.log -C config/sidekiq.yml -e development 

を使用してsidekiqワーカーを開始しました

mount_uploader :image_url, PhotoUploader 
process_in_background :image_url 

。元のファイルをアップロードした後のサイドキーグログです。しかし、アップロードされたバージョンファイルは表示されません。私はS3バケットもチェックしました(バージョンファイルはオリジナルファイルのみです)

2016-01-11T08:52:20.772Z 3983 TID-ownpyrrxk CarrierWave::Workers::ProcessAsset JID-91e3803d50defb2d1419cef1 INFO: start 
2016-01-11T08:52:31.119Z 3983 TID-ownpyrrxk CarrierWave::Workers::ProcessAsset JID-91e3803d50defb2d1419cef1 INFO: done: 10.347 sec 

ありがとうございます。この#113からhttps://github.com/lardawge/carrierwave_backgrounder#background-options

そのは明らかに示して、

# This stores the original file with no processing/versioning. 
# It will upload the original file to s3. 

careerwave_backgrounderのREADMEから:私の提案で、ここで、いくつかのドキュメンテーションを調査した後アドバンス

+0

バグのような音、あなたは宝石をデバッグしようとしたのですか?このような奇妙なgot'chasを探した? https://stackoverflow.com/questions/15490972/carrierwave-processed-images-not-uploading-to-aws-s3?rq=1 – bbozo

+0

@rohitクマール君はまだこの問題を抱えていますか?私は今これに直面しており、私はそれを解決する方法については考えていません。一日中、グーグルグーグルしていますが、何も見つかりませんでした。 –

答えて

0

で 感謝を助けてください著者は

I found a bug related to Rmagick but no issue with versions 
を言っ

あなたはMiniMagick/ImageMagickの代わりにRMagickを試すことができます。

ドキュメントは、同様の問題を探すために:

https://github.com/lardawge/carrierwave_backgrounder/issues/113

https://github.com/lardawge/carrierwave_backgrounder/issues/130

Rails CarrierWave versions are not created for some reason

感謝を!

+0

でもミニマッギを試しましたが、同じ問題です。 –

関連する問題