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_url ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'app/models/locomotive/concerns/asset/vignette.rb', line 20 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, self.updated_at.to_i) if format end |
#big_vignette_url ⇒ Object
30 31 32 33 34 35 36 |
# File 'app/models/locomotive/concerns/asset/vignette.rb', line 30 def big_vignette_url format = if self.image? || self.pdf? '200x200#' end Locomotive::Dragonfly.thumbnail_pdf(self.source, format, self.updated_at.to_i) if format end |
#vignette_url ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/models/locomotive/concerns/asset/vignette.rb', line 6 def vignette_url if self.image? # In some case (like an invalid extension) the height, width can be nill # In that case we should directly return the url if self.width && self.height && self.width < 85 && self.height < 85 self.source.url else Locomotive::Dragonfly.resize_url(self.source, '85x85#', self.updated_at.to_i) end elsif self.pdf? Locomotive::Dragonfly.thumbnail_pdf(self.source, '85x85#', self.updated_at.to_i) end end |