blobsterix 0.0.31 → 0.0.32

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: a1b4e9b58a1661c708d9ac142fc024e6d8a9ade4
4
- data.tar.gz: 65864bd8e7ba85eea992a657c6dac5278e733e21
3
+ metadata.gz: 84d8040f056cf1de1de49568af0cccf424a6c990
4
+ data.tar.gz: 436842aa680d447ca3e6307f2ae984f6b0931aed
5
5
  SHA512:
6
- metadata.gz: 7a093e1ba033c6ccc930bd12196c8dacc378840a669e8fcf7cacf7cda92bdeda9eeb41a0b39a6a465cb9e1c3b30745053c923258f17cace08af72481495940df
7
- data.tar.gz: 101beace4d57ba6454d8937144250db5ed97b21e22e35b3cbb284ae7da0f662e31f655ea1b2c7d120a5dc7d93bd98ae626b714af9dbf5c4469bf7c61f5b71211
6
+ metadata.gz: 8a0baf3c7a14c6f7d7b9b3fec9e4aa00a9b88a3dae2f14c14a689bdee0a814120d29c07ed43e7fd639d96cdfa86096df067afeea3daa70a32a61639563519dd1
7
+ data.tar.gz: 56f9c9ed4ff63b50cfa31cc6e31b4e3aae15b6a1ae005eadaf0b2040fb61ce8bb78b071555805ed56089322794a125f441b2cadd55b1fcd48b701b41fea7972e
data/CHANGELOG.txt CHANGED
@@ -1,3 +1,9 @@
1
+ = 0.0.32
2
+ * added new transformation: croppercent allows a picture to be cropped via
3
+ percentage. 100%=1000, 1%=10, 0.5%=5
4
+ 500x500+100+100
5
+ width: 50%, height: 50%, x: 10%, y: 10%
6
+ wrong values will fail the transformation
1
7
  = 0.0.31
2
8
  * changed the cache invalidation call to use a meta_data object as well as blobaccess
3
9
  * brakes current cache_checker implementations!
@@ -59,4 +65,3 @@
59
65
  * adding maxsize
60
66
  = 0.0.4
61
67
  * The first rc
62
-
@@ -9,7 +9,7 @@ module Blobsterix::Transformations::Impl
9
9
  def self.name_
10
10
  @name
11
11
  end
12
-
12
+
13
13
  def self.is_format=(obj)
14
14
  @is_format=obj
15
15
  end
@@ -17,16 +17,16 @@ module Blobsterix::Transformations::Impl
17
17
  def self.is_format_
18
18
  @is_format
19
19
  end
20
-
20
+
21
21
  def self.setTypes(input,output)
22
22
  @input= ::Blobsterix::AcceptType.new input
23
23
  @output= ::Blobsterix::AcceptType.new output
24
24
  end
25
-
25
+
26
26
  def self.input_type_
27
27
  @input
28
28
  end
29
-
29
+
30
30
  def self.output_type_
31
31
  @output
32
32
  end
@@ -121,6 +121,17 @@ module Blobsterix::Transformations::Impl
121
121
  image.write target_path
122
122
  end
123
123
 
124
+ create_simple_trafo("croppercent", "image/*", "image/*", false) do |input_path, target_path, value|
125
+ values = /(\d+)x(\d+)\+(\d+)\+(\d+)/.match(value)
126
+ raise StandardError.new("The provided cropping values are wrong") unless values
127
+ width,height,x,y = values[1..-1].map{|i| i.to_i}
128
+ raise StandardError.new("Values are to big") if width+x>1000 || height+y>1000
129
+
130
+ image = MiniMagick::Image.open(input_path)
131
+ image.crop "#{width/1000.0*image[:width]}x#{height/1000.0*image[:height]}+#{x/1000.0*image[:width]}+#{y/1000.0*image[:height]}"
132
+ image.write target_path
133
+ end
134
+
124
135
  # create_simple_trafo("image2HTML", "image/*", "text/html", true) do |input_path, target_path, value|
125
136
  # type = "image/*"
126
137
  # File.open(input_path) {|file|
@@ -228,4 +239,4 @@ module Blobsterix::Transformations::Impl
228
239
  out.write(file.as_json.to_json)
229
240
  end
230
241
  end
231
- end
242
+ end
@@ -1,3 +1,3 @@
1
1
  module Blobsterix
2
- VERSION = "0.0.31"
2
+ VERSION = "0.0.32"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blobsterix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.31
4
+ version: 0.0.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Sudmann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-16 00:00:00.000000000 Z
11
+ date: 2015-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json