Class: ZooniverseData::Projects::Sunspot

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

Instance Method Summary collapse

Instance Method Details

#customize_subjectObject



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

def customize_subject
  standard_path = entry.location['standard']
  standard_jpg_path = standard_path.sub '.eps', '.jpg'
  
  standard = convert_image(standard_path).resize(width: 360, height: 360, force: true).write_to path: standard_jpg_path
  inverted = convert_image(standard.path, remove_original: false).invert.write_to prefix: 'inverted'
  
  if entry.location['context']
    context_image = convert_to_jpeg(entry.location['context'])
    set_location standard: standard.path, inverted: inverted.path, context: context_image.try(:path)
  else
    set_location standard: standard.path, inverted: inverted.path
  end
end