0.03
Low commit activity in last 3 years
No release in over a year
Adds Dropbox storage support for the Paperclip gem. Dropbox account required.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 0.1.21
~> 5.0
 Project Readme

PaperclipDropboxStorage¶ ↑

Dropbox storage support for kt-paperclip file attachment plugin.

Install¶ ↑

You can let bundler install Paperclip Dropbox Plugin by adding this line to your application’s Gemfile:

gem 'paperclipdropbox'

And then execute:

bundle install

Or install it yourself as:

gem install paperclipdropbox

Then run the authotization task

rails paperclipdropbox:authorize

you’ll then be given a url to login to dropbox to authorize this plugin access to your dropbox account.

Usage¶ ↑

In your model:

class User < ActiveRecord::Base
  has_attached_file :avatar,
                    styles: { medium: "300x300>", thumb: "100x100>" }, 
                    default_url: "/missing.png",
                    storage: :Dropbox,
                    path: ":class/:attachment/:style/:id_:filename"
end

Add a migration script to add the dropbox_share_urls column

class AddDropboxShareIdsToUsers < ActiveRecord::Migration[7.0]
  def change
    add_column :users, :dropbox_share_urls, :string, default: "{}", null: false
  end
end

Optional¶ ↑

App Folder¶ ↑

This is the first folder in your dropbox before the paths take effect

Usage¶ ↑

app_folder: "Rails_Super_App", # defaults to "Paperclip_Dropbox" if not passed

Remove Url Redirects¶ ↑

This is a experimental.. the urls provided by Dropbox are redirecting urls. this adds additional time to the image load to the user. this option will follow the redirect url and get the direct url to pass to the browser.

However this url will expire in 3-4 hours. The direct url is cached in Rails with a lifetime of 3 hours. at wich point it will retreive a new direct url to use.

AGAIN EXPERIMENTAL so this can cause longer page loads when it needs to go and get the new direct url.

Usage¶ ↑

remove_url_redirects: true, # default is false