carrierwave_imagevoodoo 0.0.6-java → 0.0.7-java
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 158f0f3c812b06f9deb873a78a025c85bd6588da
|
4
|
+
data.tar.gz: a173c5cfb274dc619d0f5167790bd029da4f0210
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a98ca2aec9916c7bcb4236fa51b70756a6bcaef32a4ab3700816cd7ac8d955ec43d4b09079bf02521b70553a7e67ab0fbe7d6b87e4886d8bcbb2959c4f3a622
|
7
|
+
data.tar.gz: cb223102fd73b4266cc7735a5f405792362745faca80dd963e6e0391bf905e6e1cb2a0a87f40df8bf49fbba126cdc0afc46faba3347689b9880fe2b211ab5739
|
@@ -32,9 +32,7 @@ module CarrierWave
|
|
32
32
|
manipulate! do |image|
|
33
33
|
yield(image) if block_given?
|
34
34
|
|
35
|
-
image.
|
36
|
-
"#{current_path.chomp(File.extname(current_path))}.#{format}"
|
37
|
-
)
|
35
|
+
image.save "#{current_path.chomp(File.extname(current_path))}.#{format}"
|
38
36
|
end
|
39
37
|
end
|
40
38
|
|
@@ -81,7 +79,7 @@ module CarrierWave
|
|
81
79
|
end
|
82
80
|
|
83
81
|
i2.with_crop( x_offset, y_offset, new_width + x_offset, new_height + y_offset) do |file|
|
84
|
-
file.
|
82
|
+
file.save current_path
|
85
83
|
end
|
86
84
|
end
|
87
85
|
end
|
@@ -122,19 +120,11 @@ module CarrierWave
|
|
122
120
|
#end
|
123
121
|
|
124
122
|
def image_voodoo_image
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
def format
|
129
|
-
format = if respond_to? :filename
|
130
|
-
File.extname filename
|
131
|
-
else
|
132
|
-
File.extname current_path
|
123
|
+
if file.respond_to? :rewind
|
124
|
+
file.rewind
|
133
125
|
end
|
134
126
|
|
135
|
-
|
136
|
-
format[1..-1]
|
137
|
-
end
|
127
|
+
::ImageVoodoo.with_bytes file.read
|
138
128
|
end
|
139
129
|
|
140
130
|
def manipulate!
|
@@ -147,7 +137,7 @@ module CarrierWave
|
|
147
137
|
ratio = [w_ratio, h_ratio].min
|
148
138
|
|
149
139
|
image.scale(ratio) do |img|
|
150
|
-
img.
|
140
|
+
img.save current_path
|
151
141
|
end
|
152
142
|
end
|
153
143
|
end
|
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe CarrierWave::ImageVoodoo do
|
4
4
|
let :klass do
|
5
|
-
Class.new do
|
5
|
+
Class.new(CarrierWave::Uploader::Base) do
|
6
6
|
include CarrierWave::ImageVoodoo
|
7
7
|
end
|
8
8
|
end
|
@@ -13,7 +13,7 @@ describe CarrierWave::ImageVoodoo do
|
|
13
13
|
|
14
14
|
before do
|
15
15
|
FileUtils.cp(file_path("cat.jpg"), file_path("cat_copy.jpg"))
|
16
|
-
subject.stub(:file).and_return(
|
16
|
+
subject.stub(:file).and_return(CarrierWave::SanitizedFile.new(file_path("cat_copy.jpg")))
|
17
17
|
subject.stub(:current_path).and_return(file_path("cat_copy.jpg"))
|
18
18
|
subject.stub(:cached?).and_return true
|
19
19
|
end
|