Module: Locomotive::Concerns::Asset::Vignette

Included in:
Locomotive::ContentAsset
Defined in:
app/models/locomotive/concerns/asset/vignette.rb

Instance Method Summary collapse

Instance Method Details

#alternative_vignette_urlObject


18
19
20
21
22
23
24
25
26
# File 'app/models/locomotive/concerns/asset/vignette.rb', line 18

def alternative_vignette_url
  format = if self.image? && self.width && self.height
    '190x120>'
  elsif self.pdf?
    '190x120#'
  end

  Locomotive::Dragonfly.thumbnail_pdf(self.source, format) if format
end

#big_vignette_urlObject


28
29
30
31
32
33
34
# File 'app/models/locomotive/concerns/asset/vignette.rb', line 28

def big_vignette_url
  format = if self.image? || self.pdf?
    '200x200#'
  end

  Locomotive::Dragonfly.thumbnail_pdf(self.source, format) if format
end

#vignette_urlObject


6
7
8
9
10
11
12
13
14
15
16
# File 'app/models/locomotive/concerns/asset/vignette.rb', line 6

def vignette_url
  if self.image?
    if self.width < 85 && self.height < 85
      self.source.url
    else
      Locomotive::Dragonfly.resize_url(self.source, '85x85#')
    end
  elsif self.pdf?
    Locomotive::Dragonfly.thumbnail_pdf(self.source, '85x85#')
  end
end