Qiniu Storage support for CarrierWave
This gem adds storage support for Qiniu to Carrierwave
example: https://github.com/huobazi/carrierwave-qiniu-example
Add the following to your application's Gemfile:
gem 'carrierwave-qiniu', '~> 1.2.2'
gem 'carrierwave-i18n' # If you need to use locales other than EnglishAnd then execute:
$ bundleOr install it yourself as:
$ gem install carrierwave-qiniu -v 1.2.2You'll need to configure it in config/initializers/carrierwave.rb
::CarrierWave.configure do |config|
config.storage = :qiniu
config.qiniu_access_key = "your qiniu access_key"
config.qiniu_secret_key = 'your qiniu secret_key'
config.qiniu_bucket = "carrierwave-qiniu-example"
config.qiniu_bucket_domain = "carrierwave-qiniu-example.aspxboy.com"
config.qiniu_bucket_private = true #default is false
config.qiniu_block_size = 4*1024*1024
config.qiniu_protocol = "http"
config.qiniu_up_host = 'http://up.qiniug.com' #七牛上传海外服务器,国内使用可以不要这行配置
endFor more information on qiniu, please read http://developer.qiniu.com/docs/v6/
And then in your uploader, set the storage to :qiniu:
class AvatarUploader 'imageView/0/w/400', :xlarge => 'imageView/0/w/1600'
self.qiniu_bucket = "avatars"
self.qiniu_bucket_domain = "avatars.files.example.com"
end
user.avatar.url(:thumb, inline: true)
# http://.../avatar.jpg?imageView2/1/w/400
Sync Qiniu styles of uploader
$ rake carrierwave:qiniu:sync_styles
# Bucket: bucket_name_1, Set style: thumb => imageView2/1/w/200
# Bucket: bucket_name_2, Set style: large => imageView2/1/w/800
You can see a example project on: https://github.com/huobazi/carrierwave-qiniu-example
or see the spec test on https://github.com/huobazi/carrierwave-qiniu/blob/master/spec/carrierwave-qiniu_spec.rb
See the LICENSE.
git checkout -b my-new-feature)git commit -am 'Added some feature')git push origin my-new-feature)See the Contributors List.
See the CHANGELOGS.md.
No open issues yet, or sync has not completed.