Class: ZooniverseData::Projects::Penguin

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

Instance Method Summary collapse

Instance Method Details

#customize_subjectObject



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/zooniverse_data/projects/penguin.rb', line 6

def customize_subject
  original = convert_image(entry.location['standard']).input_image
  original_dims = original.size rescue OpenStruct.new(width: nil, height: nil)
  resized = converter_for(original.path, type: 'standard', max_size: 1000)
  thumb = converter_for(original.path, type: 'thumbnail', max_size: 400, quality: 50)
  entry.update :$set => {
    'location.standard' => resized,
    'location.thumb' => thumb,
    'metadata.original_size' => { width: original_dims.width, height: original_dims.height }
  }
end