Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Let's you easily interface with Resizor.com's REST API. Includes Rails helpers.
Ruby HTML

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
Gemfile
README.rdoc
Rakefile
resizor.gemspec

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 %>
Something went wrong with that request. Please try again.