carrierwave_imagevoodoo 0.0.8-java → 0.1.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/carrierwave_imagevoodoo.gemspec +1 -1
- data/jars/twelvemonkeys-common-image-3.0-SNAPSHOT.jar +0 -0
- data/jars/twelvemonkeys-common-io-3.0-SNAPSHOT.jar +0 -0
- data/jars/twelvemonkeys-common-lang-3.0-SNAPSHOT.jar +0 -0
- data/jars/twelvemonkeys-imageio-core-3.0-SNAPSHOT.jar +0 -0
- data/jars/twelvemonkeys-imageio-jpeg-3.0-SNAPSHOT.jar +0 -0
- data/jars/twelvemonkeys-imageio-metadata-3.0-SNAPSHOT.jar +0 -0
- data/jars/twelvemonkeys-imageio-tiff-3.0-SNAPSHOT.jar +0 -0
- data/lib/carrierwave_imagevoodoo.rb +11 -0
- data/lib/carrierwave_imagevoodoo/version.rb +1 -1
- data/spec/carrierwave_imagevoodoo_spec.rb +68 -47
- data/spec/fixtures/cat_cmyk.jpg +0 -0
- metadata +12 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16dcb397920759e5b4b63dd3132919f16e3e1bc8
|
4
|
+
data.tar.gz: e6c8e67e65202f97434d8f8643dda72fd94692c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94b14970ed1c2eaf0024265f8179478c51a1f0bfa21206e2b4ad5cd6095589e8d644b0e87041113e5a65ec39d12e73f3a259b102aaa0ecefee9fb81c05c81f7b
|
7
|
+
data.tar.gz: 1b099769e24093a5f36ec84ca1fd74a0cb29ed93165adb882efa5eef8cf86f3aea32cd773eccc6a5354a7e6528d0ef26fa4f54f1680f8d3da5c35f59eb470f42
|
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.email = ["taz@zenapsis.com"]
|
7
7
|
gem.description = "CarrierWave support for ImageVoodoo"
|
8
8
|
gem.summary = "A simple CarrierWave processor utilizing ImageVoodoo for processing"
|
9
|
-
gem.homepage = "https://github.com/
|
9
|
+
gem.homepage = "https://github.com/tazsingh/carrierwave_imagevoodoo"
|
10
10
|
|
11
11
|
gem.files = `git ls-files`.split($\)
|
12
12
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,4 +1,15 @@
|
|
1
1
|
require "carrierwave"
|
2
|
+
%w[
|
3
|
+
common-lang
|
4
|
+
common-io
|
5
|
+
common-image
|
6
|
+
imageio-core
|
7
|
+
imageio-metadata
|
8
|
+
imageio-jpeg
|
9
|
+
imageio-tiff
|
10
|
+
].each do |dep|
|
11
|
+
require File.expand_path("../../jars/twelvemonkeys-#{dep}-3.0-SNAPSHOT.jar", __FILE__)
|
12
|
+
end
|
2
13
|
require "image_voodoo"
|
3
14
|
require "active_support/concern"
|
4
15
|
|
@@ -11,78 +11,99 @@ describe CarrierWave::ImageVoodoo do
|
|
11
11
|
klass.new
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
subject.stub(:cached?).and_return true
|
19
|
-
end
|
14
|
+
shared_examples_for :image_actions do
|
15
|
+
describe "#resize_to_fit" do
|
16
|
+
context "image is larger than dimensions" do
|
17
|
+
before { subject.resize_to_fit(200, 200) }
|
20
18
|
|
21
|
-
|
22
|
-
|
23
|
-
end
|
19
|
+
it { should have_dimensions(127, 200) }
|
20
|
+
end
|
24
21
|
|
25
|
-
|
26
|
-
|
27
|
-
before { subject.resize_to_fit(200, 200) }
|
22
|
+
context "image's largest side matches dimensions" do
|
23
|
+
before { subject.resize_to_fit(1000, 1000) }
|
28
24
|
|
29
|
-
|
30
|
-
|
25
|
+
it { should have_dimensions(635, 1000) }
|
26
|
+
end
|
31
27
|
|
32
|
-
|
33
|
-
|
28
|
+
context "image is upscaled if smaller than dimensions" do
|
29
|
+
before { subject.resize_to_fit(2000, 2000) }
|
34
30
|
|
35
|
-
|
31
|
+
it { should have_dimensions(1270, 2000) }
|
32
|
+
end
|
36
33
|
end
|
37
34
|
|
38
|
-
|
39
|
-
|
35
|
+
describe '#resize_to_fill' do
|
36
|
+
context "image is exactly the same dimensions" do
|
37
|
+
before { subject.resize_to_fill(200, 200) }
|
40
38
|
|
41
|
-
|
42
|
-
|
43
|
-
end
|
39
|
+
it { should have_dimensions(200, 200) }
|
40
|
+
end
|
44
41
|
|
45
|
-
|
46
|
-
|
47
|
-
before { subject.resize_to_fill(200, 200) }
|
42
|
+
context "image is scaled up if smaller than dimensions" do
|
43
|
+
before { subject.resize_to_fill(1000, 1000) }
|
48
44
|
|
49
|
-
|
45
|
+
it { should have_dimensions(1000, 1000) }
|
46
|
+
end
|
50
47
|
end
|
51
48
|
|
52
|
-
|
53
|
-
|
49
|
+
describe '#resize_to_limit' do
|
50
|
+
context "image fits within height constraints" do
|
51
|
+
before { subject.resize_to_limit(700, 200) }
|
54
52
|
|
55
|
-
|
56
|
-
|
57
|
-
end
|
53
|
+
it { should have_dimensions(127, 200) }
|
54
|
+
end
|
58
55
|
|
59
|
-
|
60
|
-
|
61
|
-
before { subject.resize_to_limit(700, 200) }
|
56
|
+
context "image fits within width constraints" do
|
57
|
+
before { subject.resize_to_limit(127, 2000) }
|
62
58
|
|
63
|
-
|
64
|
-
|
59
|
+
it { should have_dimensions(127, 200) }
|
60
|
+
end
|
65
61
|
|
66
|
-
|
67
|
-
|
62
|
+
context "image does not scale up if smaller than dimensions" do
|
63
|
+
before { subject.resize_to_limit(2000, 2000) }
|
68
64
|
|
69
|
-
|
65
|
+
it { should have_dimensions(635, 1000) }
|
66
|
+
end
|
70
67
|
end
|
71
68
|
|
72
|
-
|
73
|
-
|
69
|
+
describe "#dimensions" do
|
70
|
+
its(:dimensions) { should == [635, 1000] }
|
74
71
|
|
75
|
-
|
72
|
+
context "after processing" do
|
73
|
+
before { subject.resize_to_limit(127, 2000) }
|
74
|
+
|
75
|
+
its(:dimensions) { should == [127, 200] }
|
76
|
+
end
|
76
77
|
end
|
77
78
|
end
|
78
79
|
|
79
|
-
|
80
|
-
|
80
|
+
context "RGB images" do
|
81
|
+
before do
|
82
|
+
FileUtils.cp(file_path("cat.jpg"), file_path("cat_copy.jpg"))
|
83
|
+
subject.stub(:file).and_return(CarrierWave::SanitizedFile.new(file_path("cat_copy.jpg")))
|
84
|
+
subject.stub(:current_path).and_return(file_path("cat_copy.jpg"))
|
85
|
+
subject.stub(:cached?).and_return true
|
86
|
+
end
|
87
|
+
|
88
|
+
after do
|
89
|
+
FileUtils.rm(file_path("cat_copy.jpg"))
|
90
|
+
end
|
91
|
+
|
92
|
+
it_should_behave_like :image_actions
|
93
|
+
end
|
81
94
|
|
82
|
-
|
83
|
-
|
95
|
+
context "CMYK images" do
|
96
|
+
before do
|
97
|
+
FileUtils.cp(file_path("cat_cmyk.jpg"), file_path("cat_cmyk_copy.jpg"))
|
98
|
+
subject.stub(:file).and_return(CarrierWave::SanitizedFile.new(file_path("cat_cmyk_copy.jpg")))
|
99
|
+
subject.stub(:current_path).and_return(file_path("cat_cmyk_copy.jpg"))
|
100
|
+
subject.stub(:cached?).and_return true
|
101
|
+
end
|
84
102
|
|
85
|
-
|
103
|
+
after do
|
104
|
+
FileUtils.rm(file_path("cat_cmyk_copy.jpg"))
|
86
105
|
end
|
106
|
+
|
107
|
+
it_should_behave_like :image_actions
|
87
108
|
end
|
88
109
|
end
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carrierwave_imagevoodoo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Tasveer Singh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: carrierwave
|
@@ -95,12 +95,20 @@ files:
|
|
95
95
|
- benchmarks/images/cat.jpg
|
96
96
|
- benchmarks/minimagick_vs_imagevoodoo.rb
|
97
97
|
- carrierwave_imagevoodoo.gemspec
|
98
|
+
- jars/twelvemonkeys-common-image-3.0-SNAPSHOT.jar
|
99
|
+
- jars/twelvemonkeys-common-io-3.0-SNAPSHOT.jar
|
100
|
+
- jars/twelvemonkeys-common-lang-3.0-SNAPSHOT.jar
|
101
|
+
- jars/twelvemonkeys-imageio-core-3.0-SNAPSHOT.jar
|
102
|
+
- jars/twelvemonkeys-imageio-jpeg-3.0-SNAPSHOT.jar
|
103
|
+
- jars/twelvemonkeys-imageio-metadata-3.0-SNAPSHOT.jar
|
104
|
+
- jars/twelvemonkeys-imageio-tiff-3.0-SNAPSHOT.jar
|
98
105
|
- lib/carrierwave_imagevoodoo.rb
|
99
106
|
- lib/carrierwave_imagevoodoo/version.rb
|
100
107
|
- spec/carrierwave_imagevoodoo_spec.rb
|
101
108
|
- spec/fixtures/cat.jpg
|
109
|
+
- spec/fixtures/cat_cmyk.jpg
|
102
110
|
- spec/spec_helper.rb
|
103
|
-
homepage: https://github.com/
|
111
|
+
homepage: https://github.com/tazsingh/carrierwave_imagevoodoo
|
104
112
|
licenses: []
|
105
113
|
metadata: {}
|
106
114
|
post_install_message:
|
@@ -126,4 +134,5 @@ summary: A simple CarrierWave processor utilizing ImageVoodoo for processing
|
|
126
134
|
test_files:
|
127
135
|
- spec/carrierwave_imagevoodoo_spec.rb
|
128
136
|
- spec/fixtures/cat.jpg
|
137
|
+
- spec/fixtures/cat_cmyk.jpg
|
129
138
|
- spec/spec_helper.rb
|