carrierwave-imageoptimizer 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MmY5MTE2NzBhNWNkY2Y0NjQ4YjA2M2E4MThkNzY5Y2Y1ODcyMTFiZA==
4
+ YjU2OWI2OTU1NjZhYTg4MWUzMmMzOGQzZDdjODc4YWU4MTI0ZTY4Yw==
5
5
  data.tar.gz: !binary |-
6
- MjI5MjJmNWRjMDIyMWIwOGU3YjY0NzA1YWFhMjBiYjViMTQ1MGM0Zg==
6
+ YTEyNGQxNTI2ZjJjYWNmNTQzY2M5NDg5M2U1ZDFkODYxMzI3MDhiYQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- M2ZlZDUxN2UzMTMzODcxMDQxNGE0MWJiZTVhZjAwNjMwNmMwYTAzZTEwN2Ri
10
- OTFhYjFmYTE0MDExN2M4OTI2Zjc5NTkzYmJkZDEwZWU1NDE2Zjg5MmI0Mzc3
11
- MmVhZTk4YTg3YmQ3ZjcyMzE0YzNjYzVlNDgyMzU2M2ZjN2EzOTA=
9
+ NmUwNWYwZjlkYTk1ODk2NDU2NWIyNDg2MGFkM2UzZjY2NmE3NWE4NTljNjYx
10
+ NTAwNGU4YzViNzEzYzZiNTk5MTQwZjlkMjZiMTk3NjQyZjVlYmUyZGY3YWYz
11
+ NWZjNDZmZmRkOWFjNmJiNWNiODc0NTAwZWYyYjRhZGM0OTJjOTg=
12
12
  data.tar.gz: !binary |-
13
- NzViYjM5MzU0ZjkyOTQ1NWM5MWMzMjRjODM0NTcxM2Y2NTM2ODkxMzMyZGE4
14
- YjcyNmUxNTFlZWI3MWJlM2FlMGU3MWM1NjQwYWM5YmY0ZDlkNzY4Yzc3NDZm
15
- NDZiMmFkMjU5OTRkMjY1ODI4OTBkNWJhYjQ3NWVhZWFiODEwODE=
13
+ YTFjMTcyNDdiMWM2MzUzNTg5MDdmY2U3NTQ1N2ExN2Y1ZDNhZDkyMDYzYjMz
14
+ Y2M4ZmVlYjE3YWMxMDhkMDFjOTc3YzFmNTI5YmIzZWJjNTM5OTEzYTAzY2Nl
15
+ YWFlZjNkZTNkN2ZiMzkxY2Y5OTliNjgzNTY2ZWQ0NGY4ZWFmOTI=
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/.travis.yml CHANGED
@@ -5,4 +5,12 @@ rvm:
5
5
  - ruby-head
6
6
  - 2.0.0
7
7
  - 1.9.3
8
- - rbx-19mode
8
+ - rbx-2.2.1
9
+ - rbx-2.2.0
10
+ - rbx-2.1.1
11
+
12
+ matrix:
13
+ allow_failures:
14
+ - rvm: rbx-2.2.1
15
+ - rvm: rbx-2.2.0
16
+ - rvm: rbx-2.1.1
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  This gem allows you to simply optimize CarrierWave images via jpegoptim or optipng using the image_optimizer gem.
4
4
 
5
- Tested against 1.9.3, 2.0.0, ruby-head, jruby-19mode, jruby-head, and rbx-19mode
5
+ Tested against 1.9.3, 2.0.0, ruby-head, jruby-19mode, jruby-head, rbx-2.1.1, rbx-2.2.0, and rbx-2.2.1
6
6
 
7
7
  [![Build Status](https://secure.travis-ci.org/jtescher/carrierwave-imageoptimizer.png)]
8
8
  (http://travis-ci.org/jtescher/carrierwave-imageoptimizer)
@@ -71,6 +71,20 @@ class MyUploader < CarrierWave::Uploader::Base
71
71
  end
72
72
  ```
73
73
 
74
+ ##### Lossy JPEG optimization
75
+
76
+ Pass an optional `quality` parameter to target a specific lossy JPG quality level (0-100), default is lossless
77
+ optimization. PNGs will ignore the quality setting.
78
+
79
+ ```ruby
80
+ class MyUploader < CarrierWave::Uploader::Base
81
+ ...
82
+ version :thumbnail do
83
+ process :optimize, quality: 50
84
+ end
85
+ end
86
+ ```
87
+
74
88
  ## Contributing
75
89
 
76
90
  1. Fork it
@@ -3,8 +3,8 @@ require "carrierwave-imageoptimizer/version"
3
3
 
4
4
  module CarrierWave
5
5
  module ImageOptimizer
6
- def optimize
7
- ::ImageOptimizer.new(current_path).optimize
6
+ def optimize(options = {})
7
+ ::ImageOptimizer.new(current_path, options).optimize
8
8
  end
9
9
  end
10
10
  end
@@ -1,5 +1,5 @@
1
1
  module CarrierWave
2
2
  module ImageOptimizer
3
- VERSION = "1.1.1"
3
+ VERSION = "1.2.0"
4
4
  end
5
5
  end
@@ -2,6 +2,6 @@ require 'spec_helper'
2
2
 
3
3
  describe CarrierWave::ImageOptimizer do
4
4
  it "should have a VERSION constant" do
5
- subject.const_get('VERSION').should_not be_empty
5
+ expect(subject.const_get('VERSION')).to_not be_empty
6
6
  end
7
- end
7
+ end
@@ -11,9 +11,16 @@ describe CarrierWave::ImageOptimizer do
11
11
 
12
12
  it 'delegates to a new instance of ImageOptimizer with the current path to the file' do
13
13
  image_optimizer = double(::ImageOptimizer)
14
- ::ImageOptimizer.should_receive(:new).with('/tmp/path/to/image.jpg').and_return(image_optimizer)
15
- image_optimizer.should_receive(:optimize)
14
+ expect(::ImageOptimizer).to receive(:new).with('/tmp/path/to/image.jpg', {}).and_return(image_optimizer)
15
+ expect(image_optimizer).to receive(:optimize)
16
16
  @uploader.new.optimize
17
17
  end
18
+
19
+ it 'accepts an optional quality param to target a specific lossy JPG quality level ' do
20
+ image_optimizer = double(::ImageOptimizer)
21
+ expect(::ImageOptimizer).to receive(:new).with('/tmp/path/to/image.jpg', quality: 99).and_return(image_optimizer)
22
+ expect(image_optimizer).to receive(:optimize)
23
+ @uploader.new.optimize(quality: 99)
24
+ end
18
25
  end
19
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carrierwave-imageoptimizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Tescher
metadata.gz.sig CHANGED
Binary file