https://github.com/johnvuko/paperclip-storage-http
HTTP storage support for paperclip.
https://github.com/johnvuko/paperclip-storage-http
Last synced: over 1 year ago
JSON representation
HTTP storage support for paperclip.
- Host: GitHub
- URL: https://github.com/johnvuko/paperclip-storage-http
- Owner: johnvuko
- Created: 2011-12-23T23:41:59.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2012-12-09T04:05:53.000Z (over 13 years ago)
- Last Synced: 2025-01-11T14:15:43.544Z (over 1 year ago)
- Language: Ruby
- Homepage:
- Size: 97.7 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Paperclip storage HTTP
======================
HTTP storage support for paperclip.
Requirements
------------
You must have in your Gemfile:
gem "paperclip", :git => "git://github.com/thoughtbot/paperclip.git"
Installation
------------
Include the gem in your Gemfile:
gem 'paperclip-storage-http', :git => 'https://github.com/jonathantribouharet/paperclip-storage-http'
Usage
-----
Minimal configuration in your model:
class User < ActiveRecord::Base
has_attached_file :avatar,
:storage => :http,
:http_url_upload => 'http://mycdn.com/upload',
:http_url_remove => 'http://mycdn.com/remove',
:url => "http://mycdn.com/images/:attachment/:id/:style/:basename.:extension"
end
Custom configuration in your model:
class User < ActiveRecord::Base
has_attached_file :avatar,
:storage => :http,
:http_url_upload => 'http://mycdn.com/upload',
:http_url_remove => 'http://mycdn.com/remove',
:http_params_upload => {'secret' => 'my_secret_key_for_upload'},
:http_params_remove => {'secret' => 'my_secret_key_for_remove'},
:http_param_file_upload => 'file',
:http_param_path_upload => 'path',
:http_param_path_remove => 'path',
:path => ":attachment/:id/:style/:basename.:extension",
:url => "http://mycdn.com/images/:attachment/:id/:style/:basename.:extension"
end
* `http_url_upload` is the URL used for upload your file, it's mandatory.
* `http_url_remove` is the URL used for remove your file, it's mandatory.
* `path` is the path send to `http_url_upload` or `http_url_remove`, by default it's `:attachment/:id/:style/:basename.:extension`.
* `url` is the URL used for access to your file, it's mandatory.
* `http_params_upload` is a Hash of parameters that you can pass for the upload, it's optional.
* `http_params_remove` is a Hash of parameters that you can pass for the removal, it's optional.
* `http_param_file_upload` is name of file parameter for upload, by default it's `file`.
* `http_param_path_upload` is name of path parameter for upload, by default it's `path`.
* `http_param_path_remove` is name of path parameter for removal, by default it's `path`.
Requests on `http_url_upload` and `http_url_remove` are always POST.