Repository is archived
No commit activity in last 3 years
No release in over 3 years
JPEG and PNG compression for Paperclip gem
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 1.3
 Project Readme

Paperclip Tinify

Gem Version

JPEG and PNG compression processor for Paperclip using Tinify API.

Installation

Add to your Gemfile.

gem 'paperclip-tinify'

Configure your API key in config/initializers/paperclip.rb:

Paperclip::Tinify.tinify_key = 'YOUR_API_KEY'

By default, images will be compressed only in production environment. You can enable compression in other environments as follows:

Paperclip::Tinify.environments = [:development, :production]

API Key

Please visit Tinify to generate your API key.

Usage

This is the basic usage. This will compress both JPEG and PNG files with the default options.

class User < ActiveRecord::Base
  has_attached_file :avatar,
    styles: { medium: '300x300>', thumb: '100x100>' },
    processors: [:tinify]
end

License

paperclip-tinify is released under the MIT License.