Home

Awesome

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

Requests on http_url_upload and http_url_remove are always POST.