ruby on rails - Upload image using paperclip, fog and rackspace -
i need upload logo image rackspace using fog & paperclip.
paperclip::attachment.default_options.update({ :path => "images/:class/:id/:attachment/:style/img_:fingerprint", :storage => :fog, :fog_credentials => { :provider => 'rackspace', :rackspace_username => 'blablabla', :rackspace_api_key => 'blablabla', :persistent => false }, :fog_directory => 'blablabla', :fog_public => true, :fog_host => 'http://blablabla.rackcdn.com' })
i have settings in config/initializers/paperclip_defaults.rb
but how initialize logo catch settings. please me in confusion here.
you don't need initialize logo "catch" settings
let me explain how works:
paperclip
creates entry db, , stores file on rackspace. accessing file,paperclip
case of ensuringpaperclip
able load rackspace url correctly
i this:
#config/application.rb config.paperclip_defaults = { styles: { :medium => "x500", :thumb => "x200" }, default_url: "placeholder.png" } #config/environments/production.rb paperclip::attachment.default_options.merge!({ :path => "images/:class/:id/:attachment/:style/img_:fingerprint", :storage => :fog, :fog_credentials => { :provider => 'rackspace', :rackspace_username => 'blablabla', :rackspace_api_key => 'blablabla', :persistent => false }, :fog_directory => 'blablabla', :fog_public => true, :fog_host => 'http://blablabla.rackcdn.com' })
this allows upload rackspace in production mode. don't need change model, , call paperclip
objects this:
@model.image.url #-> yields rackspace url
if need more / clarity, please let me know. have used rackspace code & moved initializer config files
Comments
Post a Comment