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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc64ea96e349a3c9d0c3a44c93f51a9621a59814
4
- data.tar.gz: c37b4ec04cc4a1868003e4ca524e0bb799ebac0e
3
+ metadata.gz: fbb670cc2a2874d8b089f135dca8e605195d2c69
4
+ data.tar.gz: d58a142b36032aa835baf4b41448c0aae4f20716
5
5
  SHA512:
6
- metadata.gz: e4a2ffa1946c626a846cc2d68dd80bdff9af58c81d4b629d1f93f4292f76ea4393632156f9e27edbbd8ef7b994607b542cda1fbf3c6db595a02fbaca66d6baa1
7
- data.tar.gz: c11739bc5e3db2d1925512b548f50db325c7ceea4304d6b4dcab6625f2f241a64bd5dfdc121897e6d9698415a8dd49cda84451bd5ace06a68d1f516b708f2915
6
+ metadata.gz: c2f317a9d17fcc1dd2d6905b0be3f766fedbb53898b45e009d0f0d281364a3d2ef3590b2f2655aad2338f736336255d55fef037d61e796919cca0d1a8f843658
7
+ data.tar.gz: 0fbfc65faadfdb3fa728a31a4ba74aa52ddbf2b514dbbfa406e3ac883dad1fb57bddefc107826ba422086e29487961d57f79891e15da5f7cfd448b41dcb5e647
@@ -1,5 +1,5 @@
1
1
  module CarrierWave
2
2
  module ImageVoodoo
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
@@ -31,7 +31,10 @@ module CarrierWave
31
31
  def convert format
32
32
  manipulate! do |image|
33
33
  yield(image) if block_given?
34
- image.save "#{current_path.chomp(File.extname(f))}.#{format}"
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.save( self.current_path )
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
- @image_voodoo_image ||= ::ImageVoodoo.with_bytes(file.read)
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.save current_path
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 "#width" do
80
- its(:width) { should == 635 }
81
- end
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
- describe "#height" do
84
- its(:height) { should == 1000 }
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.5
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-17 00:00:00.000000000 Z
11
+ date: 2013-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: carrierwave