Class: Pageflow::LinkmapPage::MaskedImageFile

Inherits:
GeneratedImageFile show all
Defined in:
app/models/pageflow/linkmap_page/masked_image_file.rb

Constant Summary collapse

STYLES =
lambda do |attachment|
  masked_image_file = attachment.instance

  masked_image_file.present_styles.each_with_object({}) do |color, result|
    result[color.to_sym] = {
      processors: [
        :thumbnail,
        :pageflow_linkmap_page_color_mask,
        :pageflow_linkmap_page_invoke_callback
      ],
      color_map_attachment: masked_image_file.color_map_file.processed_attachment,
      format: 'png',
      geometry: GEOMETRY,
      callback: :update_processing_progress
    }
  end
end

Constants inherited from GeneratedImageFile

GeneratedImageFile::GEOMETRY

Instance Method Summary collapse

Methods inherited from GeneratedImageFile

#failed?, #publish!, #ready?, #retry!, #retryable?

Instance Method Details

#for_color(color) ⇒ Object



34
35
36
# File 'app/models/pageflow/linkmap_page/masked_image_file.rb', line 34

def for_color(color)
  attachment.styles[color.to_sym]
end

#prerequisite_filesObject



42
43
44
# File 'app/models/pageflow/linkmap_page/masked_image_file.rb', line 42

def prerequisite_files
  [color_map_file, source_image_file]
end

#present_stylesObject



38
39
40
# File 'app/models/pageflow/linkmap_page/masked_image_file.rb', line 38

def present_styles
  color_map_file.present_colors
end

#url_for_color(color) ⇒ Object



30
31
32
# File 'app/models/pageflow/linkmap_page/masked_image_file.rb', line 30

def url_for_color(color)
  attachment.url(color.to_sym)
end