Skip to content

This gem allows you to optimize CarrierWave images using the image_optim gem.

Notifications You must be signed in to change notification settings

nifuramu/carrierwave-imageoptim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Carrierwave ImageOptim Gem Version Build Status Dependency Status Code Climate

This gem allows you to optimize CarrierWave images using the image_optim gem.

Installation

Add this line to your application's Gemfile:

gem 'carrierwave-imageoptim'

And then execute:

$ bundle

Or install it yourself as:

$ gem install carrierwave-imageoptim

Usage

To add image optimization to your CarrierWave uploader, first include the module:

class MyUploader < CarrierWave::Uploader::Base
  include CarrierWave::ImageOptim
  ...
end

Then apply to all versions via:

class MyUploader < CarrierWave::Uploader::Base
  include CarrierWave::ImageOptim

  process optimize: [{
    jpegoptim: true,
    optipng: true,
    gifsicle: true
  }]
end

Or to a single image version via:

class MyUploader < CarrierWave::Uploader::Base
  include CarrierWave::ImageOptim

  version :thumbnail do
    process optimize: [{
      jpegoptim: true,
      optipng: true,
      gifsicle: true
    }]
  end
end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

About

This gem allows you to optimize CarrierWave images using the image_optim gem.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages