Class: Cardboard::Field::Image

Inherits:
Cardboard::Field show all
Defined in:
app/models/cardboard/field/image.rb

Instance Attribute Summary

Attributes inherited from Cardboard::Field

#seeding

Instance Method Summary collapse

Methods inherited from Cardboard::Field

new_with_castnew, #required?, #type, #type=

Instance Method Details

#defaultObject



21
22
23
24
# File 'app/models/cardboard/field/image.rb', line 21

def default
  # Dragonfly.app.generate(:plasma, [400, 800].sample, 600) 
  Dragonfly.app.generate(:plain, [400, 800].sample, 600, :color => '#CCCCCC')
end

#valueObject



12
13
14
15
16
17
18
19
# File 'app/models/cardboard/field/image.rb', line 12

def value
  return nil unless value_uid
  if value_uid =~ /^app\/assets\/images/
    Dragonfly.app.fetch_file(value_uid)
  else
    Dragonfly.app.fetch(value_uid)
  end
end