zooniverse_data 0.0.12 → 0.0.13

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: bd303857df8127a8118954196b758656650d3291
4
- data.tar.gz: 26d09a57b5df5c2d939487f7df476c1d4c0e28cf
3
+ metadata.gz: f669546857f4f082af77eff9a314f3cab6d4f366
4
+ data.tar.gz: 7ce537826d85a42679b586b8adc88cb77013d934
5
5
  SHA512:
6
- metadata.gz: 483e7ce5816eac80c091acbc731360e16493556a52ef9f66dc594da624898b8c93cf69ad78bf6b5d7c9dd09e54a54bc99fdad6773faf2cc1410aeb3473118f96
7
- data.tar.gz: c9640f1efb5f331ff8f748220310031167b81a726541ef838519acd8630f50567e2c2d93b701d6fbfb689d7042b6ab3093d6db844aa877ec39d21cab38fe5f4a
6
+ metadata.gz: b13b0ff745c30acd9b509715d69657a6c539fd3c85ecd6a3cdfd3707cc1b067b8a07162fdcf41ad0a023bd906a37b5f6765f914894814e75b823bc0ca5b50061
7
+ data.tar.gz: 88269d575c3004667323b66feee96ceee5a0129f3e7882199fedeb281ec099305636c827974e55c4f0a7ac546e14f507094ec53b1056b194e1990ed836010dc5
@@ -4,17 +4,26 @@ module ZooniverseData
4
4
  include Helpers
5
5
 
6
6
  def customize_subject
7
- original = convert_image(entry.location['standard'])
8
- dimensions = original.input_image.size rescue OpenStruct.new(width: nil, height: nil)
9
- resized = original.resize(width: 1_000, height: 1_000, force: false)
10
- .quality(80)
11
- .write_to(prefix: 'resized')
12
- .path
7
+ original = convert_image(entry.location['standard']).input_image
8
+ original_dims = original.size rescue OpenStruct.new(width: nil, height: nil)
9
+ resized = converter_for(original.path, type: 'standard', max_size: 1000)
10
+ thumb = converter_for(original.path, type: 'thumbnail', max_size: 400, quality: 50)
13
11
  entry.update :$set => {
14
12
  'location.standard' => resized,
15
- 'metadata.original_size' => { width: dimensions.width, height: dimensions.height }
13
+ 'location.thumb' => thumb,
14
+ 'metadata.original_size' => { width: original_dims.width, height: original_dims.height }
16
15
  }
17
16
  end
17
+
18
+ private
19
+
20
+ def converter_for(path, type: type, max_size: max_size, quality: 80)
21
+ convert_image(path, remove_original: false)
22
+ .resize(width: max_size, height: max_size, force: false)
23
+ .quality(quality)
24
+ .write_to(prefix: type)
25
+ .path
26
+ end
18
27
  end
19
28
  end
20
29
  end
@@ -1,3 +1,3 @@
1
1
  module ZooniverseData
2
- VERSION = '0.0.12'
2
+ VERSION = '0.0.13'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zooniverse_data
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Parrish
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-07 00:00:00.000000000 Z
11
+ date: 2014-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler