Class: ZooniverseData::Projects::Condor

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

Instance Method Summary collapse

Instance Method Details

#customize_subjectObject



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

def customize_subject
  original = convert_image entry.location['standard']
  dimensions = original.input_image.size rescue OpenStruct.new(width: nil, height: nil)
  resized = original.resize(width: 1200, force: false)
    .quality(80)
    .write_to(prefix: 'resized')
    .path
  
  entry.update :$set => {
    'location.standard' => resized,
    'metadata.original_size' => {
      width: dimensions.width,
      height: dimensions.height
    }
  }
end