Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
 
 
 
 
 
 
 
 

README.rdoc

Resizor

For use with resizor.com

Inspired by Thoughtbot's Paperclip

Usage

Add resizor to your Gemfile

gem 'resizor'

Install resizor gem

$ bundle install

Add a initializer to RAILS_ROOT/config/initializers/resizor.rb

Resizor.configure do |config|
  config.api_key = 'my-api-key' # find this on the Account screen when logged in on Resizor.com
  config.cdn_host = 'abc.cloudfront.net' # if you are using CloudFront to cache images generated by Resizor
end

Add Resizor fields to your model

$ rails generate resizor MyModel image

Add has_resizor_asset to MyModel

class MyModel < ActiveRecord::Base
  has_resizor_asset :image

  ...
end

Add a file field to the form for MyModel

<%= f.label :image %>
<%= f.file_field :image %>

Now you can resize your uploaded images on the fly

<% if my_model.image? %>
  <img src="<%= my_model.image.url(:size => 'c200x300') %>">
<% end %>

About

Let's you easily interface with Resizor.com's REST API. Includes Rails helpers.

Resources

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  
You can’t perform that action at this time.