Class: ZooniverseData::Projects::Orchid

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/zooniverse_data/projects/orchid.rb

Instance Method Summary collapse

Instance Method Details

#customize_subjectObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/zooniverse_data/projects/orchid.rb', line 6

def customize_subject
  if entry.location['standard'].is_a?(Array)
    thumbs = []
    entry.location['standard'].each do |image|
      original = convert_image(image).input_image
      thumbs << converter_for(original.path, type: 'thumbnail', max_size: 300, quality: 50)
    end
    entry.update :$set => {
      'location.thumb' => thumbs,
    }
  else
    original = convert_image(entry.location['standard']).input_image
    thumb = converter_for(original.path, type: 'thumbnail', max_size: 300, quality: 50)
    entry.update :$set => {
      'location.thumb' => thumb,
    }
  end
end