carrierwave_imagevoodoo 0.0.5-java → 0.0.6-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/carrierwave_imagevoodoo/version.rb +1 -1
- data/lib/carrierwave_imagevoodoo.rb +25 -12
- data/spec/carrierwave_imagevoodoo_spec.rb +7 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbb670cc2a2874d8b089f135dca8e605195d2c69
|
4
|
+
data.tar.gz: d58a142b36032aa835baf4b41448c0aae4f20716
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2f317a9d17fcc1dd2d6905b0be3f766fedbb53898b45e009d0f0d281364a3d2ef3590b2f2655aad2338f736336255d55fef037d61e796919cca0d1a8f843658
|
7
|
+
data.tar.gz: 0fbfc65faadfdb3fa728a31a4ba74aa52ddbf2b514dbbfa406e3ac883dad1fb57bddefc107826ba422086e29487961d57f79891e15da5f7cfd448b41dcb5e647
|
@@ -31,7 +31,10 @@ module CarrierWave
|
|
31
31
|
def convert format
|
32
32
|
manipulate! do |image|
|
33
33
|
yield(image) if block_given?
|
34
|
-
|
34
|
+
|
35
|
+
image.save_impl format, Java::JavaIo::File.new(
|
36
|
+
"#{current_path.chomp(File.extname(current_path))}.#{format}"
|
37
|
+
)
|
35
38
|
end
|
36
39
|
end
|
37
40
|
|
@@ -78,12 +81,18 @@ module CarrierWave
|
|
78
81
|
end
|
79
82
|
|
80
83
|
i2.with_crop( x_offset, y_offset, new_width + x_offset, new_height + y_offset) do |file|
|
81
|
-
file.
|
84
|
+
file.save_impl format, Java::JavaIo::File.new(current_path)
|
82
85
|
end
|
83
86
|
end
|
84
87
|
end
|
85
88
|
end
|
86
89
|
|
90
|
+
def dimensions
|
91
|
+
image = image_voodoo_image
|
92
|
+
|
93
|
+
[image_voodoo_image.width, image_voodoo_image.height]
|
94
|
+
end
|
95
|
+
|
87
96
|
private
|
88
97
|
|
89
98
|
def extract_dimensions(width, height, new_width, new_height, type = :resize)
|
@@ -113,7 +122,19 @@ module CarrierWave
|
|
113
122
|
#end
|
114
123
|
|
115
124
|
def image_voodoo_image
|
116
|
-
|
125
|
+
::ImageVoodoo.with_bytes File.read(current_path)
|
126
|
+
end
|
127
|
+
|
128
|
+
def format
|
129
|
+
format = if respond_to? :filename
|
130
|
+
File.extname filename
|
131
|
+
else
|
132
|
+
File.extname current_path
|
133
|
+
end
|
134
|
+
|
135
|
+
if format.size > 0
|
136
|
+
format[1..-1]
|
137
|
+
end
|
117
138
|
end
|
118
139
|
|
119
140
|
def manipulate!
|
@@ -126,16 +147,8 @@ module CarrierWave
|
|
126
147
|
ratio = [w_ratio, h_ratio].min
|
127
148
|
|
128
149
|
image.scale(ratio) do |img|
|
129
|
-
img.
|
150
|
+
img.save_impl format, Java::JavaIo::File.new(current_path)
|
130
151
|
end
|
131
152
|
end
|
132
|
-
|
133
|
-
def width
|
134
|
-
image_voodoo_image.width
|
135
|
-
end
|
136
|
-
|
137
|
-
def height
|
138
|
-
image_voodoo_image.height
|
139
|
-
end
|
140
153
|
end
|
141
154
|
end
|
@@ -76,11 +76,13 @@ describe CarrierWave::ImageVoodoo do
|
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
describe "#
|
80
|
-
its(:
|
81
|
-
|
79
|
+
describe "#dimensions" do
|
80
|
+
its(:dimensions) { should == [635, 1000] }
|
81
|
+
|
82
|
+
context "after processing" do
|
83
|
+
before { subject.resize_to_limit(127, 2000) }
|
82
84
|
|
83
|
-
|
84
|
-
|
85
|
+
its(:dimensions) { should == [127, 200] }
|
86
|
+
end
|
85
87
|
end
|
86
88
|
end
|
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.0.6
|
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-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: carrierwave
|